@Test public void testGetFirstExcludingRoot() { Version first = getFirst(Sets.newHashSet(v2, v3)); assertEquals(v2, first); }
public static Version getFirst(Set<Version> versions) { checkArgument(versions != null, "You must specify a set of 'versions'!"); Version first = null; int lowestGeneration = Integer.MAX_VALUE; for (Version version : versions) { int generation = getGeneration(version); if (generation < lowestGeneration) { lowestGeneration = generation; first = version; } } return first; }
VersionTraverser { public static Version getFirst(Set<Version> versions) { checkArgument(versions != null, "You must specify a set of 'versions'!"); Version first = null; int lowestGeneration = Integer.MAX_VALUE; for (Version version : versions) { int generation = getGeneration(version); if (generation < lowestGeneration) { lowestGeneration = generation; first = version; } } return first; } }
VersionTraverser { public static Version getFirst(Set<Version> versions) { checkArgument(versions != null, "You must specify a set of 'versions'!"); Version first = null; int lowestGeneration = Integer.MAX_VALUE; for (Version version : versions) { int generation = getGeneration(version); if (generation < lowestGeneration) { lowestGeneration = generation; first = version; } } return first; }  }
VersionTraverser { public static Version getFirst(Set<Version> versions) { checkArgument(versions != null, "You must specify a set of 'versions'!"); Version first = null; int lowestGeneration = Integer.MAX_VALUE; for (Version version : versions) { int generation = getGeneration(version); if (generation < lowestGeneration) { lowestGeneration = generation; first = version; } } return first; }  static Direction getDirection(Version from, Version to); static Version getFirst(Set<Version> versions); static Optional<List<Version>> findPath(Version from, Version to); static Optional<List<Version>> findChildPath(Version from, Version to); static Optional<List<Version>> findParentPath(Version from, Version to); static List<Stage> verifyPathAndState(State state, Version from, Version to); }
VersionTraverser { public static Version getFirst(Set<Version> versions) { checkArgument(versions != null, "You must specify a set of 'versions'!"); Version first = null; int lowestGeneration = Integer.MAX_VALUE; for (Version version : versions) { int generation = getGeneration(version); if (generation < lowestGeneration) { lowestGeneration = generation; first = version; } } return first; }  static Direction getDirection(Version from, Version to); static Version getFirst(Set<Version> versions); static Optional<List<Version>> findPath(Version from, Version to); static Optional<List<Version>> findChildPath(Version from, Version to); static Optional<List<Version>> findParentPath(Version from, Version to); static List<Stage> verifyPathAndState(State state, Version from, Version to);  }