@Override public <T> T castTo(Class<T> targetClass) { T result = super.castTo(targetClass); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); return result; }
@Override public int indexOf(Object object) { int result = super.indexOf(object); Ensure.that(result >= -1l).orThrow("The result has to be greater than or equal to -1l but was $.", result); return result; }
@Override public <T> T castTo(Class<T> targetClass) { T result = super.castTo(targetClass); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); return result; }
@Override public int count(Object arg0) { int result = super.count(arg0); Ensure.that(result >= 0).orThrow("The result has to be non-negative but was $.", result); return result; }
@Override public FreezableSet<E> toFreezableSet() { FreezableSet<E> result = super.toFreezableSet(); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || !result.isFrozen()).orThrow("The result has to be null or may not be frozen.", result); return result; }
@Override public ReadOnlyArrayIterator<E> iterator() { ReadOnlyArrayIterator<E> result = super.iterator(); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }
@Override public FreezableArray<E> toFreezableArray() { FreezableArray<E> result = super.toFreezableArray(); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || !result.isFrozen()).orThrow("The result has to be null or may not be frozen.", result); return result; }
@Override public ReadOnlyIterator<E> iterator() { ReadOnlyIterator<E> result = super.iterator(); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }
@Override public <T> T castTo(Class<T> targetClass) { T result = super.castTo(targetClass); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); return result; }
@Override public int count(Object arg0) { int result = super.count(arg0); Ensure.that(result >= 0).orThrow("The result has to be non-negative but was $.", result); return result; }
@Override public FreezableList<E> toFreezableList() { FreezableList<E> result = super.toFreezableList(); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || !result.isFrozen()).orThrow("The result has to be null or may not be frozen.", result); return result; }
@Override public ReadOnlyIterator<E> iterator() { ReadOnlyIterator<E> result = super.iterator(); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }
@Override public @Nonnull Time subtract(@Nonnull Time time) { Require.that(time != null).orThrow("The time may not be null.", time); @Nonnull Time result = super.subtract(time); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }
@Override public ReadOnlyMap<K, V> freeze() { Require.that(!isFrozen()).orThrow("The method 'freeze' may only be called on non-frozen objects."); ReadOnlyMap<K, V> result = super.freeze(); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || result.isFrozen()).orThrow("The result has to be null or frozen.", result); return result; }
@Override public ReadOnlyArray<E> freeze() { Require.that(!isFrozen()).orThrow("The method 'freeze' may only be called on non-frozen objects."); ReadOnlyArray<E> result = super.freeze(); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || result.isFrozen()).orThrow("The result has to be null or frozen.", result); return result; }
@Override public FreezableArray<E> setAll(E element) { Require.that(!isFrozen()).orThrow("The method 'setAll' may only be called on non-frozen objects."); FreezableArray<E> result = super.setAll(element); Ensure.that(result == this).orThrow("The result has to be <this> but was $.", result); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || !result.isFrozen()).orThrow("The result has to be null or may not be frozen.", result); return result; }
@Override public ReadOnlyList<E> freeze() { Require.that(!isFrozen()).orThrow("The method 'freeze' may only be called on non-frozen objects."); ReadOnlyList<E> result = super.freeze(); Ensure.that(result != null).orThrow("The result may not be null.", result); Ensure.that(result == null || result.isFrozen()).orThrow("The result has to be null or frozen.", result); return result; }
@Override public <T> T[] toArray(T[] array) { Require.that(array != null).orThrow("The array may not be null.", array); T[] result = super.toArray(array); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }
@Override public int size(int arg0) { Require.that(arg0 > 0).orThrow("The arg0 has to be positive but was $.", arg0); int result = super.size(arg0); Ensure.that(result >= 0).orThrow("The result has to be non-negative but was $.", result); return result; }
@Override public ReadOnlyListIterator<E> listIterator(int index) { Require.that(index >= 0 && index <= size()).orThrow("The index may not be negative or greater than the size of this collection but was $.", index); ReadOnlyListIterator<E> result = super.listIterator(index); Ensure.that(result != null).orThrow("The result may not be null.", result); return result; }