Start of adding copyable collections. Starting with Lists.

This commit is contained in:
2021-10-06 16:30:53 +02:00
parent 1f1aa995df
commit 07b715dd4c
7 changed files with 54 additions and 0 deletions
@@ -216,6 +216,9 @@ public class LISTS
#endif
@Override
public int size() { return 1; }
@Override
public SingletonList KEY_GENERIC_TYPE copy() { return new SingletonListBRACES(element); }
}
private static class SynchronizedArrayList KEY_GENERIC_TYPE extends SynchronizedList KEY_GENERIC_TYPE implements IARRAY KEY_GENERIC_TYPE
@@ -372,6 +375,9 @@ public class LISTS
@Override
public void size(int size) { synchronized(mutex) { l.size(size); } }
@Override
public LIST KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
}
private static class UnmodifiableRandomList KEY_GENERIC_TYPE extends UnmodifiableList KEY_GENERIC_TYPE implements RandomAccess
@@ -481,6 +487,9 @@ public class LISTS
@Override
public void size(int size) { throw new UnsupportedOperationException(); }
@Override
public LIST KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
}
private static class EmptyList KEY_GENERIC_TYPE extends COLLECTIONS.EmptyCollection KEY_GENERIC_TYPE implements LIST KEY_GENERIC_TYPE
@@ -563,5 +572,8 @@ public class LISTS
@Override
public void size(int size) { throw new UnsupportedOperationException(); }
@Override
public EmptyList KEY_GENERIC_TYPE copy() { return this; }
}
}