@Override public boolean less(Version otherVersion) { VersionImpl version = Assert.theSameClass(this, otherVersion, "otherVersion"); int length = Math.max(numbers.length, version.numbers.length); VirtualNumberIterator thisIterator = new VirtualNumberIterator(numbers, length); VirtualNumberIterator otherIterator = new VirtualNumberIterator(version.numbers, length); while (thisIterator.hasNext()) { int n = thisIterator.next(); int k = otherIterator.next(); if (n != k) { return n < k; } } // It looks like versions are equals return false; }
public VersionImpl(int[] numbers) { this.numbers = Assert.hasElements(numbers, "numbers"); }