Developer community
0 votes
209 views
asked by Sr Member (4.8k points) 10 23 31 | 209 views

1 Answer

0 votes

Syntax: Array List<E> al = new Array List<E>();

Array List<E> al = new Array List <E>(int initialcapacity);

Here, E represents element data type

Methods of Array List:

  1. Boolean add(Element obj): this method is used to place the specified element to the end of List.
  2. Void add(int position, Element obj): this method is used to insert and element at the specified position.
  3. Boolean remove(Element obj): this method is used to remove the 1st occurrence of the specified element.
  4. Element remove(int position): this method is used to remove and Element from the specified position.
  5. Void clear(): this method remove all the elements available in the Array List.
  6. Int Size(): this method will return the count of the no.of elements available in the Array List.
  7. Boolean contains(element obj): this method returns true if the specified element is available in the Array List.
  8. Element get(int position): this method is used to access an Element that is available in the specified position.
  9. Element set(int position, Element obj): this method is used replace an element in the specified position with the specified element.
answered by Expert (11.4k points) 14 22 29

Related questions

0 votes
1 answer
asked by john Guru (27.1k points) 31 48 96 | 28 views
+1 vote
1 answer
asked by keem Expert (13.2k points) 27 40 58 | 34 views
0 votes
1 answer
asked by john Guru (27.1k points) 31 48 96 | 22 views
+1 vote
1 answer
asked by keem Expert (13.2k points) 27 40 58 | 18 views
0 votes
1 answer
asked by john Guru (27.1k points) 31 48 96 | 23 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users