OlgaBerezhna / collections.pr1

Collections. Practice Task 1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collections. Practice task 1

Join the chat at https://gitter.im/changerequest/collections.pr1 1. CollectionUtils

Implement CollectionUtils utility class, that implements following useful functions:

union
intersection
unionWithoutDuplicate
intersectionWithoutDuplicate
difference

Please check CollectionUtils interface for additional info.

Also create your own unit tests to for functionality you have implemented.

2. Copy-on-write iterator

Implement copy-on-write iterator and also check that ExtendedList now supports fail-fast schema for concurrent modification.

Any method that modifies collection, should now throw ConcurrentModificationException if collection is going to be modified concurrently, for example is this case:

List<String> strings = new ArrayList<>();
strings.add("a");
Iterator<String> iterator = strings.iterator();
strings.remove(0);
iterator.next();

Also create your own unit tests to for functionality you have implemented.

2.a Improvements

Improve COW Iterator, so that it should obtain copy of initial collection only when some modification functionality is going to be called.

About

Collections. Practice Task 1

License:Apache License 2.0


Languages

Language:Java 70.7%Language:Groovy 29.3%