| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.google.common.collect.testing; |
| 18 |
|
| 19 |
import com.google.common.annotations.GwtCompatible; |
| 20 |
import com.google.common.collect.testing.SampleElements.Unhashables; |
| 21 |
import java.util.Collection; |
| 22 |
import java.util.List; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
@GwtCompatible |
| 30 |
public abstract class TestUnhashableCollectionGenerator<T extends Collection<UnhashableObject>> |
| 31 |
implements TestCollectionGenerator<UnhashableObject> { |
| 32 |
@Override |
| 33 |
public SampleElements<UnhashableObject> samples() { |
| 34 |
return new Unhashables(); |
| 35 |
} |
| 36 |
|
| 37 |
@Override |
| 38 |
public T create(Object... elements) { |
| 39 |
UnhashableObject[] array = createArray(elements.length); |
| 40 |
int i = 0; |
| 41 |
for (Object e : elements) { |
| 42 |
array[i++] = (UnhashableObject) e; |
| 43 |
} |
| 44 |
return create(array); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
protected abstract T create(UnhashableObject[] elements); |
| 52 |
|
| 53 |
@Override |
| 54 |
public UnhashableObject[] createArray(int length) { |
| 55 |
return new UnhashableObject[length]; |
| 56 |
} |
| 57 |
|
| 58 |
@Override |
| 59 |
public Iterable<UnhashableObject> order(List<UnhashableObject> insertionOrder) { |
| 60 |
return insertionOrder; |
| 61 |
} |
| 62 |
} |