Collections are now copyable

This commit is contained in:
Speiger 2021-10-06 17:48:37 +02:00
parent 6eded1f4be
commit dff173222d
3 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,9 @@ public abstract class ABSTRACT_COLLECTION KEY_GENERIC_TYPE extends AbstractColle
return modified; return modified;
} }
@Override
public COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
#if !TYPE_OBJECT #if !TYPE_OBJECT
/** {@inheritDoc} /** {@inheritDoc}
* <p>This default implementation delegates to the corresponding type-specific function. * <p>This default implementation delegates to the corresponding type-specific function.

View File

@ -129,7 +129,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
* It can be compared to Cloneable but with less exception risk * It can be compared to Cloneable but with less exception risk
* @return a Shallow Copy of the collection * @return a Shallow Copy of the collection
*/ */
public default COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); } public COLLECTION KEY_GENERIC_TYPE copy();
#if !TYPE_OBJECT #if !TYPE_OBJECT
/** /**

View File

@ -128,6 +128,9 @@ public class COLLECTIONS
return c.iterator(); return c.iterator();
} }
@Override
public COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
@Override @Override
@Primitive @Primitive
public boolean remove(Object o) { synchronized(mutex) { return c.remove(o); } } public boolean remove(Object o) { synchronized(mutex) { return c.remove(o); } }
@ -222,6 +225,8 @@ public class COLLECTIONS
@Override @Override
public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.unmodifiable(c.iterator()); } public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.unmodifiable(c.iterator()); }
@Override @Override
public COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
@Override
@Deprecated @Deprecated
public boolean remove(Object o) { throw new UnsupportedOperationException(); } public boolean remove(Object o) { throw new UnsupportedOperationException(); }
@Override @Override
@ -358,5 +363,7 @@ public class COLLECTIONS
public void clear() {} public void clear() {}
@Override @Override
public int size() { return 0; } public int size() { return 0; }
@Override
public EmptyCollection KEY_GENERIC_TYPE copy() { return this; }
} }
} }