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.util.Zipper.java
public static <A, B> List<Pair<A, B>> up(Iterable<A> a, Iterable<B> b) { ArrayList<Pair<A, B>> result = Lists.newArrayList(); Iterator<A> iterA = a.iterator(); Iterator<B> iterB = b.iterator(); while (iterA.hasNext()) { Preconditions.checkArgument(iterB.hasNext(), "B is shorter than A, must be same size"); A aa = iterA.next();/*w w w. java2 s. c o m*/ B bb = iterB.next(); result.add(Pair.of(aa, bb)); } Preconditions.checkArgument(!iterB.hasNext(), "A is shorter than B, must be same size"); return result; }
From source file:com.yahoo.elide.core.exceptions.JsonPatchExtensionException.java
public JsonPatchExtensionException(int status, final JsonNode errorNode) { super(status); response = Pair.of(status, errorNode); }
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) { return asMap(new Pair[] { Pair.of(k1, v1), Pair.of(k2, v2) }); }
From source file:com.github.steveash.jg2p.util.Zipper.java
public static <A, B> List<Pair<A, B>> upTo(Iterable<A> a, B b) { ArrayList<Pair<A, B>> result = Lists.newArrayList(); for (A aa : a) { result.add(Pair.of(aa, b)); }/*from w ww . j ava 2 s .c o m*/ return result; }
From source file:com.yahoo.elide.utils.coerce.BidirectionalConvertUtilBean.java
public void register(Class<?> sourceType, Class<?> targetType, Converter converter) { Pair<Class<?>, Class<?>> key = Pair.of(sourceType, targetType); bidirectionalConverters.put(key, converter); }
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) { return asMap(Pair.of(k1, v1), Pair.of(k2, v2), Pair.of(k3, v3)); }
From source file:de.ellpeck.actuallyadditions.mod.recipe.FuelHandler.java
private static void addFuel(Item item, int metadata, int value) { fuelList.put(Pair.of(item, metadata), value); }
From source file:com.github.tddts.jet.util.SpringUtil.java
/** * Checks if given bean is a dynamic proxy and if it is so returns actual bean behind proxy and it's type. * * @param bean bean object// w ww . j a v a2s .c om * @return pair containing of bean and it's class * @throws BeanInitializationException in case of any exception */ public static Pair<Class<?>, Object> checkForDinamicProxy(Object bean) throws BeanInitializationException { try { Class<?> type = bean.getClass(); if (AopUtils.isJdkDynamicProxy(bean)) { Advised advised = (Advised) bean; type = advised.getTargetClass(); bean = advised.getTargetSource().getTarget(); } return Pair.of(type, bean); } catch (Exception e) { throw new BeanInitializationException(e.getMessage(), e); } }
From source file:cn.liutils.vis.animation.CubicSplineCurve.java
public void addPoint(double x, double y) { pts.add(Pair.of(x, y)); pts.sort((Pair<Double, Double> a, Pair<Double, Double> b) -> { return a.getLeft().compareTo(b.getLeft()); });//from w ww .j a v a 2 s . c om }
From source file:de.pixida.logtest.reporting.LoggerListener.java
@Override protected void append(final LoggingEvent event) { this.logEntries.add(Pair.of(event.getLevel(), event.getMessage().toString())); }