List of usage examples for org.apache.commons.lang3.tuple Pair of
public static <L, R> Pair<L, R> of(final L left, final R right)
Obtains an immutable pair of from two objects inferring the generic types.
This factory allows the pair to be created using inference to obtain the generic types.
From source file:com.github.steveash.jg2p.align.FilterWalkerDecorator.java
public static Set<Pair<String, String>> readFromFile(File file) throws IOException { Splitter splitter = Splitter.on('^').trimResults(); List<String> lines = Files.readLines(file, Charsets.UTF_8); HashSet<Pair<String, String>> result = Sets.newHashSet(); for (String line : lines) { if (isBlank(line)) { continue; }/* w ww . j ava2 s .c o m*/ Iterator<String> fields = splitter.split(line).iterator(); String x = fields.next(); String y = fields.next(); result.add(Pair.of(x, y)); } return result; }
From source file:com.github.steveash.jg2p.util.Zipper.java
public static <A, B> List<Pair<A, B>> upTo(A a, Iterable<B> b) { ArrayList<Pair<A, B>> result = Lists.newArrayList(); for (B bb : b) { result.add(Pair.of(a, bb)); }/*from w ww . j a v a 2 s. co m*/ return result; }
From source file:com.yahoo.elide.utils.coerce.BidirectionalConvertUtilBean.java
@Override public Converter lookup(Class<?> sourceType, Class<?> targetType) { Pair<Class<?>, Class<?>> key = Pair.of(sourceType, targetType); if (bidirectionalConverters.containsKey(key)) { return bidirectionalConverters.get(key); }/*from ww w. j a v a 2 s . c o m*/ return super.lookup(sourceType, targetType); }
From source file:com.github.blindpirate.gogradle.util.MapUtils.java
@SuppressWarnings("unchecked") public static <K, V> Map<K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { return asMap(new Pair[] { Pair.of(k1, v1), Pair.of(k2, v2), Pair.of(k3, v3), Pair.of(k4, v4) }); }
From source file:alfio.manager.location.MockLocationManager.java
@Override public Pair<String, String> geocode(String address) { return Pair.of("40.1740944", "18.168802");//home sweet home :P }
From source file:de.ellpeck.actuallyadditions.mod.recipe.FuelHandler.java
private static int getFuelValue(ItemStack stack) { if (stack != null && stack.getItem() != null) { Pair<Item, Integer> pair = Pair.of(stack.getItem(), stack.getItemDamage()); if (fuelList.containsKey(pair)) { return fuelList.get(pair); } else {//from www. ja v a 2s. c o m pair = Pair.of(stack.getItem(), 0); if (fuelList.containsKey(pair)) { return fuelList.get(pair); } } } return 0; }
From source file:enumj.EnumeratorGenerator.java
public static Enumerator<Pair<EnumeratorGenerator, EnumeratorGenerator>> generatorPairs() { return EnumerableGenerator.generatorPairs() .map(p -> Pair.of(new EnumeratorGenerator(p.getLeft()), new EnumeratorGenerator(p.getRight()))) .enumerator();/*w w w . jav a 2s . c o m*/ }
From source file:com.comphenix.protocol.metrics.Statistics.java
public static Pair<String, String> splitVersion() { String version = ProtocolLibrary.getPlugin().getDescription().getVersion(); if (version.contains("-b")) { String[] split = version.split("-b"); return Pair.of(split[0], split[1]); } else {/*from w w w .j a v a 2s .c om*/ return Pair.of(version, "Unknown"); } }
From source file:com.intuit.karate.JsonUtils.java
public static Pair<String, String> getParentAndLeafPath(String path) { int pos = path.lastIndexOf('.'); String left = path.substring(0, pos == -1 ? 0 : pos); String right = path.substring(pos + 1); return Pair.of(left, right); }
From source file:com.github.blindpirate.gogradle.util.MapUtils.java
@SuppressWarnings("unchecked") public static <K, V> Map<K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { return asMap(Pair.of(k1, v1), Pair.of(k2, v2), Pair.of(k3, v3), Pair.of(k4, v4), Pair.of(k5, v5)); }