### Build and Install JavaTuples with Maven Source: https://github.com/arxila/javatuples/blob/main/BUILD.txt Execute this command from the JavaTuples project root to build and install the project. This will create a JAR file and install it into your local Maven repository. ```bash mvn clean:clean install ``` -------------------------------- ### Tag Release and Prepare Next Development Version Source: https://github.com/arxila/javatuples/blob/main/RELEASING.txt Create a Git tag for the release and then update the project to the next development iteration (e.g., X.Y.[Z+1]-SNAPSHOT). ```shell mvn scm:tag -Dtag=javatuples-X.Y.Z mvn versions:set -DprocessAllModules=true -DnewVersion=X.Y.[Z+1]-SNAPSHOT mvn versions:commit git add .; git commit -m "Prepare for next development iteration" git push ``` -------------------------------- ### Configure Maven Settings for Snapshots and Staging Source: https://github.com/arxila/javatuples/blob/main/RELEASING.txt Configure access to snapshot and staging servers in your Maven settings.xml file. Replace placeholder credentials with your actual token username and password. ```xml central [TOKEN USERNAME FROM CENTRAL] [TOKEN PASSWORD FROM CENTRAL] central-portal-snapshots [TOKEN USERNAME FROM CENTRAL] [TOKEN PASSWORD FROM CENTRAL] ``` -------------------------------- ### Deploy Release Artifacts Source: https://github.com/arxila/javatuples/blob/main/RELEASING.txt Compile and deploy the release artifacts to the staging repositories using the 'releases' profile. ```shell mvn -P releases clean compile deploy ``` -------------------------------- ### Generate Javadoc for JavaTuples Source: https://github.com/arxila/javatuples/blob/main/BUILD.txt Run this Maven command from the JavaTuples root folder to generate HTML Javadoc documentation for the project. ```bash mvn javadoc:javadoc ``` -------------------------------- ### Set and Commit New Version using Maven Source: https://github.com/arxila/javatuples/blob/main/RELEASING.txt Update all modules to a new release version (X.Y.Z) and commit the changes. This prepares the project for a release build. ```shell mvn versions:set -DprocessAllModules=true -DnewVersion=X.Y.Z mvn versions:commit git add . git commit -m "Prepare release javatuples-X.Y.Z" git push ``` -------------------------------- ### Generate GPG Signature for Distribution Zip Source: https://github.com/arxila/javatuples/blob/main/RELEASING.txt Generate a detached GPG signature (.asc) for the distribution zip file using your release key. ```shell gpg -ab --default-key key_ID_for_releases@arxila.io javatuples-X.Y.Z-dist.zip ``` -------------------------------- ### Grow and Shrink Tuples Source: https://github.com/arxila/javatuples/blob/main/README.md Create larger tuples by appending elements using `withValueN()` or smaller tuples by removing elements using `withoutValueX()`. ```java var pair = Pair.of("Hello", 42); // Pair var trio = pair.withValue2("!"); // Grow to Trio var solo = pair.withoutValue1(); // Shrink to Solo ``` -------------------------------- ### Creating Numbered Tuples with Constructors Source: https://github.com/arxila/javatuples/blob/main/README.md Instantiate numbered tuples like Tuple2 directly using their constructors. The types of the elements are inferred from the arguments. ```java // Numbered tuples var tuple2 = new Tuple2<>("Hello", 42); // tuple2 : Tuple2 ``` -------------------------------- ### Creating Numbered Tuples with Factory Methods Source: https://github.com/arxila/javatuples/blob/main/README.md Use static `of` factory methods for a concise way to create numbered tuples. This is an alternative to using constructors. ```java // Numbered tuples var tuple2 = Tuple2.of("Hello", 42); // tuple2 : Tuple2 ``` -------------------------------- ### Creating Named Tuples with Constructors Source: https://github.com/arxila/javatuples/blob/main/README.md Instantiate named tuples like Pair and Trio directly using their constructors. The types of the elements are inferred from the arguments. ```java // Named tuples var pair = new Pair<>("Hello", 42); // pair : Pair var trio = new Trio<>("A", "B", "C"); // trio : Trio ``` -------------------------------- ### Creating Named Tuples with Factory Methods Source: https://github.com/arxila/javatuples/blob/main/README.md Use static `of` factory methods for a concise way to create named tuples. This is an alternative to using constructors. ```java // Named tuples var pair = Pair.of("Hello", 42); // pair : Pair var trio = Trio.of("A", "B", "C"); // trio : Trio ``` -------------------------------- ### Maven Dependency for javatuples Source: https://github.com/arxila/javatuples/blob/main/USAGE.txt Add this dependency to your Maven project's pom.xml to include the javatuples library. Replace {version} with the desired version. ```xml io.arxila javatuples {version} compile ``` -------------------------------- ### Access Tuple Values by Index Source: https://github.com/arxila/javatuples/blob/main/README.md Access individual tuple values using `valueN()` methods. The `values()` method returns all tuple elements as a List. ```java // Direct access String value0 = pair.value0(); Integer value1 = pair.value1(); Long value9 = decet.value9(); // All values as a list var values = tuple.values(); // values: List ``` -------------------------------- ### Creating Tuples from Collections Source: https://github.com/arxila/javatuples/blob/main/README.md Tuples can be created from Lists or arrays. When created this way, all elements are treated as a common type derived from the collection. ```java var valuesList = List.of("Hello", 42); // valuesList: List (effectively) var valuesArray = new String[] {"A", "B", "C"}; // ... var pair = Pair.of(valuesList); // pair : Pair var trio = Trio.of(valuesArray); // trio : Trio ``` -------------------------------- ### Compare Tuples Ignoring Order Source: https://github.com/arxila/javatuples/blob/main/README.md Use the `equalsIgnoreOrder()` method to compare two tuples for equality based on their contents, disregarding the order of elements. ```java if (tuple.equalsIgnoreOrder(otherTuple)) {...} // true if tuples contain the same values in any order ``` -------------------------------- ### Create New Tuple with Modified Value Source: https://github.com/arxila/javatuples/blob/main/README.md Tuples are immutable. Use `withValueN()` methods to create a new tuple instance with a specific value replaced. ```java var pair = Pair.of("Hello", 42); // Pair("Hello", 42) var newPair = pair.withValue1("World"); // Pair("Hello", "World") ``` -------------------------------- ### Iterate and Check Tuple Contents Source: https://github.com/arxila/javatuples/blob/main/README.md Tuples are iterable. Use `contains*` methods to check for the presence of specific values or combinations of values within the tuple. ```java // Iteration for (final Object value : tuple) { // ...do things } // Contains methods if (tuple.contains("Hello")) {...} // true if a single value is contained in the tuple if (tuple.containsAll("Hello", 42)) {...} // true if all specified values are contained in the tuple if (tuple.containsAny(41,4 2)) {...} // true if any of the specified values are contained in the tuple ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.