Back to marketplace

Unit 7 - ArrayList

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

ArrayList object

Back (Answer)

Mutable and contains object references Dynamic in size Resizable length Not designed to store primitives Slightly slower

#2
Front (Question)

ArrayList can only be used when

Back (Answer)

imported

#3
Front (Question)

ArrayList class is implemented using

Back (Answer)

Arrays

#4
Front (Question)

framework

Back (Answer)

prewritten, high-performing and efficient code that can handle and use objects of groups of data

#5
Front (Question)

import statement

Back (Answer)

import.java.util.ArrayList

#6
Front (Question)

Declaring a variable to reference an ArrayList object

Back (Answer)

ArrayList variableName;

#7
Front (Question)

Instantiate an ArrayList object

Back (Answer)

Stores only elements of the same, non-primitive DataType new ArrayList (); OR new ArrayList (n); n= initial # of elements

#8
Front (Question)

DataType must equal

Back (Answer)

any non-primitive data type

#9
Front (Question)

Although ArrayList objects are designed to store references to objects, using

Back (Answer)

Wrapper class allows primitive values to be stored in ArrayList

#10
Front (Question)

What ArrayList method returns the number of element in the list?

Back (Answer)

int size ( )

#11
Front (Question)

What ArrayList method appends obj to end of list and returns true?

Back (Answer)

boolean (E obj) ducks. add(Duck1); * adding Duck1 to the end of an array named ducks

#12
Front (Question)

What ArrayList method inserts obj at position index, moving elements at position index and higher to the right and adds 1 to the list size?

Back (Answer)

void add (int index, E obj) symbols. add(3, flowers) * adding “flowers” to index 3 of an array named symbols, moving all original items at 3 or above 1 index higher and adding 1 to ArrayList

#13
Front (Question)

What ArrayList method removes element from position index, moving elements at position index and higher to the left and subtracts 1 to the list size while returning the elements formerly stored at position index?

Back (Answer)

E remove (int index) Star s1 = stars. remove(2); *removing element at index 2 in an array named stars & storing it as s1 System.out.print(s1); *former element will be printed

#14
Front (Question)

What ArrayList method replaces element at position index with obj and returns element formerly at position index?

Back (Answer)

E set (int index, E obj) Stars s1 = stars.set(1, green star) *setting element at index 1 in an array named stars & storing it as s1 System.out.print(s1); *former element will be printed

#15
Front (Question)

What ArrayList method returns element at position index in list?

Back (Answer)

E get (int index) Star s2 = stars.get(0);

#16
Front (Question)

ArrayList is preferred over ArrayList because

Back (Answer)

It allows compiler to find errors that would otherwise be found at run-time

#17
Front (Question)

Java allows the generic ArrayList when the generic type E

Back (Answer)

specifies the type of elements

#18
Front (Question)

When ArrayList is specified,

Back (Answer)

types of references parameters and return type when using the methods are type E

#19
Front (Question)

When passed as a parameter in a method, ArrayList are passed as

Back (Answer)

References to address and not copies of their values

#20
Front (Question)

When a method updates elements of a passed ArrayList, the ArrayList’s elements are

Back (Answer)

Updated automatically

#21
Front (Question)

If a method with an ArrayList as a parameter only involves accessing elements of ArrayList without assigning or updating the elements from the ArrayList, then

Back (Answer)

the myMethod method signature is sufficient myMethod(questions); connects to method used with array name inside parentheses

#22
Front (Question)

If the method involves adding, updating, or storing elements of the passed ArrayList, then

Back (Answer)

you need to specify the data type of elements stored in ArrayList myMethod1(questions); *call to method public static void myMethod1(ArrayList arr) {} *method being called

#23
Front (Question)

In order to return an ArrayList, it is preferred that you

Back (Answer)

specify the type of data of elements that the ArrayList stores

#24
Front (Question)

Algorithm for summing all elements in an ArrayList

Back (Answer)

1 - create an int sum and set to 0 2 - length of element at index i will be added to sum 3 - loop will repeat until all elements has been traversed 4- display sum