JDK 1.5 compatibility.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2691 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2010-01-08 22:04:02 +00:00
parent 503d57d7de
commit d2464d9feb
+11 -4
View File
@@ -212,7 +212,6 @@ public class IntSets
@Override public boolean contains (int value) { return false; } @Override public boolean contains (int value) { return false; }
@Override public int size () { return 0; } @Override public int size () { return 0; }
@Override
public Interator interator () public Interator interator ()
{ {
return EMPTY_INTERATOR; return EMPTY_INTERATOR;
@@ -257,12 +256,12 @@ public class IntSets
*/ */
protected static abstract class FindingInterator extends AbstractInterator protected static abstract class FindingInterator extends AbstractInterator
{ {
@Override public boolean hasNext () public boolean hasNext ()
{ {
return _hasNext || (_hasNext = findNext()); return _hasNext || (_hasNext = findNext());
} }
@Override public int nextInt () public int nextInt ()
{ {
if (_hasNext) { if (_hasNext) {
_hasNext = false; _hasNext = false;
@@ -481,7 +480,15 @@ public class IntSets
array[index++] = it.nextInt(); array[index++] = it.nextInt();
} while ((index < Integer.MAX_VALUE) && it.hasNext()); } while ((index < Integer.MAX_VALUE) && it.hasNext());
// we may need to trim the array down to size // we may need to trim the array down to size
return (index == Integer.MAX_VALUE) ? array : Arrays.copyOf(array, index); // 1.6ism: return (index == Integer.MAX_VALUE) ? array : Arrays.copyOf(array, index);
if (index == Integer.MAX_VALUE) {
return array;
} else {
int[] trimmed = new int[index];
System.arraycopy(array, 0, trimmed, 0, index);
return trimmed;
}
} }
/** The ints we <b>don't</b> contain. */ /** The ints we <b>don't</b> contain. */