Monday, March 1, 2021

Collection Methods

 1. ArrayList: 

Add---

1. public boolean add(object)

2. public void add(index(int), element or collection)

3.public boolean addAll(Collection E)

4. public boolean addAll(index(int), collection E)

Remove---

1. public Element remove(int)

2. public boolean remove(object)

3. public boolean removeRange(int, int)

4. public boolean removeAll(collection)

5. public boolean removeIf(Predicate)

Replace----

1. public object set(index, object)-> it is like replace method and return old object

2. public replaceAll()


2. LinkedList:

Add----

1. public boolean add(object e)

2. public void add(index, Object element)

3. public boolean addAll(Collection c)

4. public boolean addAll(index, Collection c)

5. public void addFirst(e)

6. public void addLast(e)

Remove----

1. void remove()

2. remove()

3. remove()

4. removeAll()

5. removeFirst()

6. removeFirstOccurrence()

7. removeIf()

8. removeLast()

9. removeLastOccurrence()


No comments:

Post a Comment

String coding questioon

  How do you reverse a given string in place? ( solution ) How do you print duplicate characters from a string? ( solution ) How do you chec...