From 831988db6575d0f86a7ac5da91fdff47836486a9 Mon Sep 17 00:00:00 2001 From: Xevion Date: Wed, 29 Jan 2020 20:34:43 -0600 Subject: [PATCH] set interface collections example included --- study/COLLECTIONS.MD | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/study/COLLECTIONS.MD b/study/COLLECTIONS.MD index 0d98c75..c614a1b 100644 --- a/study/COLLECTIONS.MD +++ b/study/COLLECTIONS.MD @@ -133,6 +133,19 @@ Deque d = new ArrayDeque(); ### Set Interface +A Set is a unordered list of elements with one basic principle different - all items are unique, duplicate elements are not allowed. + +While `null` values are allowed in Sets, the element distinction rule is passed on to `null` values too, and thus at most only one can be in a Set at any time. + +Set is implemented by [HashSet](#hashset-class), [LinkedHashSet](#linkedhashset-class), and [TreeSet](#treeset-class). + +```java +Set s; +s = new HashSet(); +s = new LinkedHashSet(); +s = new TreeSet(); +``` + ### SortedSet Interface ## Classes