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.blindpirate.gogradle.core.dependency.produce.external.gopm.GopmfileParser.java
private Pair<String, String> parseLine(String line) { String[] nameAndValue = splitAndTrim(line, "="); String name = nameAndValue[0]; String value = nameAndValue.length > 1 ? nameAndValue[1] : ""; return Pair.of(name, value); }
From source file:com.splicemachine.db.impl.ast.ColumnUtils.java
static Pair<Integer, Integer> RSCoordinate(ResultColumn rc) { ResultColumn resultColumn = rc;//from w w w . j a va 2 s.c o m ValueNode vn = rc.getExpression(); if (vn instanceof CastNode) { ValueNode castOperand = ((CastNode) vn).getCastOperand(); if (castOperand instanceof VirtualColumnNode) { VirtualColumnNode vcn = (VirtualColumnNode) castOperand; resultColumn = vcn.getSourceColumn(); } else if (castOperand instanceof ColumnReference) { ColumnReference cr = (ColumnReference) castOperand; resultColumn = cr.getSourceResultColumn(); } } return Pair.of(resultColumn.getResultSetNumber(), resultColumn.getVirtualColumnId()); }
From source file:enumj.EnumerableTest.java
@Test public void testOf_Iterator() { System.out.println("of"); EnumerableGenerator.generatorPairs().limit(100) .map(p -> Pair.of(p.getLeft().ofIteratorEnumerable(), p.getRight().ofIteratorEnumerable())) .forEach(p -> assertTrue(p.getLeft().elementsEqual(p.getRight()))); }
From source file:com.teambrmodding.neotech.client.models.ModelItemFluidStorage.java
/******************************************************************************************************************* * IPerspectiveAwareModel * *******************************************************************************************************************/ @Override//from www . ja v a 2 s . co m public Pair<? extends IBakedModel, Matrix4f> handlePerspective( ItemCameraTransforms.TransformType cameraTransformType) { return Pair.of(this, transforms.get(cameraTransformType) != null ? transforms.get(cameraTransformType).getMatrix() : get(0, 0, 0, 0, 0, 0, 1.0f).getMatrix()); }
From source file:de.hasait.clap.impl.AbstractCLAPNode.java
protected final Pair<CLAPUsageCategoryImpl, StringBuilder> handleUsageCategory( final Map<CLAPUsageCategoryImpl, StringBuilder> pCategories, final CLAPUsageCategoryImpl pCurrentCategory, final StringBuilder pResult) { final CLAPUsageCategoryImpl currentCategory = getUsageCategory() != null ? getUsageCategory() : pCurrentCategory;//from www. j a v a 2 s .c om StringBuilder result; if (!currentCategory.equals(pCurrentCategory)) { if (pResult != null) { pResult.append(nls(currentCategory.getTitleNLSKey())); } if (pCategories.containsKey(currentCategory)) { return null; } else { result = new StringBuilder(); pCategories.put(currentCategory, result); } } else { result = pResult; } return Pair.of(currentCategory, result); }
From source file:com.yahoo.bullet.parsing.ProjectionTest.java
@Test public void testNullFieldName() { Projection projection = new Projection(); Map<String, String> fields = new HashMap<>(); fields.put(null, "test"); fields.put("map_field.foo", "foo"); projection.setFields(fields);/*from w w w. j a v a 2 s . co m*/ BulletRecord record = RecordBox.get().add("field", "test").addMap("map_field", Pair.of("foo", "baz")) .getRecord(); BulletRecord actual = projection.project(record); BulletRecord expected = RecordBox.get().add("foo", "baz").getRecord(); Assert.assertEquals(actual, expected); }
From source file:net.lldp.checksims.algorithm.AlgorithmRunnerTest.java
@Test public void TestRunAlgorithmSinglePair() throws ChecksimsException { Set<Pair<Submission, Submission>> submissions = singleton(Pair.of(a, b)); Collection<AlgorithmResults> results = AlgorithmRunner.runAlgorithm(submissions, detectNothing, logger); AlgorithmUtils.checkResultsContainsPairs(results, submissions); }
From source file:edu.sdsc.scigraph.internal.reachability.ReachabilityIndexTest.java
@Test public void testGetConnectedPairs() { Set<Node> src = newHashSet(a, d); Set<Node> dest = newHashSet(b, c); Set<Pair<Node, Node>> r = new HashSet<>(); r.add(Pair.of(a, b)); r.add(Pair.of(a, c));/*from w w w. j a v a 2 s.com*/ Set<Pair<Node, Node>> result = index.getConnectedPairs(src, dest); assertThat(result, is(r)); }
From source file:edu.wpi.checksims.algorithm.AlgorithmRunnerTest.java
@Test public void TestRunAlgorithmAllPossiblePairs() { Set<Pair<Submission, Submission>> submissions = setFromElements(Pair.of(a, b), Pair.of(a, c), Pair.of(a, d), Pair.of(b, c), Pair.of(b, d), Pair.of(c, d)); Collection<AlgorithmResults> results = AlgorithmRunner.runAlgorithm(submissions, detectNothing); AlgorithmUtils.checkResultsContainsPairs(results, submissions); }
From source file:eu.stratosphere.nephele.streaming.taskmanager.chaining.TaskChain.java
public static Pair<TaskChain, TaskChain> splitAndAnnounceChain(TaskChain chain, int splitIndex, ExecutorService backgroundWorkers, final QosReporterConfigCenter configCenter) { final TaskChain newLeftChain = new TaskChain(); final TaskChain newRightChain = new TaskChain(); newLeftChain.tasksInChain.addAll(chain.tasksInChain.subList(0, splitIndex)); newRightChain.tasksInChain.addAll(chain.tasksInChain.subList(splitIndex, chain.tasksInChain.size())); newLeftChain.fixTasksChainedStatus(); newRightChain.fixTasksChainedStatus(); newLeftChain.taskControlFlowsUnderManipulation.set(true); newRightChain.taskControlFlowsUnderManipulation.set(true); backgroundWorkers.execute(new Runnable() { @Override/*from w w w . ja v a 2s .c o m*/ public void run() { try { ChainingUtil.unchainAndAnnounceTaskThreads(newLeftChain, newRightChain, configCenter); } catch (Exception e) { LOG.error("Error during chain construction.", e); } finally { newLeftChain.taskControlFlowsUnderManipulation.set(false); newRightChain.taskControlFlowsUnderManipulation.set(false); } } }); return Pair.of(newLeftChain, newRightChain); }