tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,21 @@
|
|||
def list = [1, 2, 3, 'a', 'b', 'c', 2, 3, 4, 'b', 'c', 'd']
|
||||
assert list.size() == 12
|
||||
println " Original List: ${list}"
|
||||
|
||||
// Filtering the List
|
||||
list.unique()
|
||||
assert list.size() == 8
|
||||
println " Filtered List: ${list}"
|
||||
|
||||
list = [1, 2, 3, 'a', 'b', 'c', 2, 3, 4, 'b', 'c', 'd']
|
||||
assert list.size() == 12
|
||||
|
||||
// Converting to Set
|
||||
def set = new HashSet(list)
|
||||
assert set.size() == 8
|
||||
println " Set: ${set}"
|
||||
|
||||
// Converting to Order-preserving Set
|
||||
set = new LinkedHashSet(list)
|
||||
assert set.size() == 8
|
||||
println "List-ordered Set: ${set}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue