Simple java tuples.
Guild offers you tuple classes from two to nine elements.
- Pair
- A tuple of two elements.
- Triplet
- A tuple of three elements.
- Quartet
- A tuple of four elements.
- Quintet
- A tuple of five elements.
- Sextet
- A tuple of six elements.
- Septet
- A tuple of seven elements.
- Octet
- A tuple of eight elements.
- Ennead
- A tuple of nine elements.
compile 'com.os.operando.guild:guild:1.6.0'
or Maven:
<dependency>
<groupId>com.os.operando.guild</groupId>
<artifactId>guild</artifactId>
<version>1.6.0</version>
</dependency>
Pair<String, Integer> pair = Pair.create("pair", 0);
System.out.println(pair.getFirst());
System.out.println(pair.getSecond());
Triplet<String, Integer, Boolean> triplet = Triplet.create("triplet", 0, false);
System.out.println(triplet.getFirst());
System.out.println(triplet.getSecond());
System.out.println(triplet.getThird());
Quartet<String, Integer, Boolean, LocalDate> quartet = Quartet.create("quartet", 0, false, LocalDate.now());
System.out.println(quartet.getFirst());
System.out.println(quartet.getSecond());
System.out.println(quartet.getThird());
System.out.println(quartet.getFourth());
Quintet<String, Integer, Boolean, LocalDate, List<String>> quintet = Quintet.create("quintet", 0, false, LocalDate.now(), Arrays.asList("quintet"));
System.out.println(quintet.getFirst());
System.out.println(quintet.getSecond());
System.out.println(quintet.getThird());
System.out.println(quintet.getFourth());
System.out.println(quintet.getFive());
Sextet<String, Integer, Boolean, LocalDate, List<String>, Set<String>> sextet =
Sextet.create("sextet", 0, false, LocalDate.now(), Arrays.asList("sextet"), Collections.singleton("sextet"));
System.out.println(sextet.getFirst());
System.out.println(sextet.getSecond());
System.out.println(sextet.getThird());
System.out.println(sextet.getFourth());
System.out.println(sextet.getFive());
System.out.println(sextet.getSix());
Septet<String, Integer, Boolean, LocalDate, List<String>, Set<String>, Long> septet =
Septet.create("septet", 0, false, LocalDate.now(), Arrays.asList("septet"), Collections.singleton("septet"), Long.MAX_VALUE);
System.out.println(septet.getFirst());
System.out.println(septet.getSecond());
System.out.println(septet.getThird());
System.out.println(septet.getFourth());
System.out.println(septet.getFive());
System.out.println(septet.getSix());
System.out.println(septet.getSeven());
Octet<String, Integer, Boolean, LocalDate, List<String>, Set<String>, Long, UUID> octet =
Octet.create("octet", 0, false, LocalDate.now(), Arrays.asList("octet"), Collections.singleton("octet"), Long.MAX_VALUE, UUID.randomUUID());
System.out.println(octet.getFirst());
System.out.println(octet.getSecond());
System.out.println(octet.getThird());
System.out.println(octet.getFourth());
System.out.println(octet.getFive());
System.out.println(octet.getSix());
System.out.println(octet.getSeven());
System.out.println(octet.getEight());
Ennead<String, Integer, Boolean, LocalDate, List<String>, Set<String>, Long, UUID, StringBuilder> ennead =
Ennead.create("ennead", 0, false, LocalDate.now(), Arrays.asList("ennead"), Collections.singleton("ennead"), Long.MAX_VALUE, UUID.randomUUID(), new StringBuilder("ennead"));
System.out.println(ennead.getFirst());
System.out.println(ennead.getSecond());
System.out.println(ennead.getThird());
System.out.println(ennead.getFourth());
System.out.println(ennead.getFive());
System.out.println(ennead.getSix());
System.out.println(ennead.getSeven());
System.out.println(ennead.getEight());
System.out.println(ennead.getNine());
Guild supports up to nine elements in the future.
The class name is expected to be the same as the javatuples.
Apache Version 2.0
Copyright (C) 2018 Shinobu Okano
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.