Java Data Structures

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/32

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:46 PM on 6/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

33 Terms

1
New cards

init a HashMap mapping strings to integers with the variable name 'map'

Map<String, Integer> map = new HashMap<>();

2
New cards

method to add an entry to a HashMap

put(key, item)

3
New cards

method to retrieve an item from a HashMap

get(key)

4
New cards

method to retrieve an item from a HashMap with a default value

getOrDefault(key, default)

5
New cards

method to check if a key exists in a HashMap

containsKey(key)

6
New cards

method to remove an item from a HashMap

remove(key)

7
New cards

method to check the number of entries in a HashMap

size()

8
New cards

init a list containing integers named 'list' that is empty

List<Integer> list = new ArrayList<>();

9
New cards

method to append an item to a list

add(item)

10
New cards

method to insert an item to a list at an index

add(index, item)

11
New cards

method to index a List

get(index)

12
New cards

Method to update an index of a List

set(index, item)

13
New cards

method to remove an index from a List

remove(index)

14
New cards

method to sort a List

Collections.sort(list)

15
New cards

method to reverse a List

Collections.reverse(list)

16
New cards

init a Hashset containing Integers named 'set'

Set set = new HashSet<>();

17
New cards

method to add an item to a HashSet

add(item)

18
New cards

method to check if an item exists in a HashSet

contains(item)

19
New cards

method to remove an item from a HashSet

remove(item)

20
New cards

method to do a union on a HashSet

addAll(other)

21
New cards

method to do a intersection on a HashSet

retainAll(other)

22
New cards

init a deque named 'dq' containing Integers

Deque dq = new ArrayDeque<>();

23
New cards

method to enqueue into a Deque

offerLast(item)

24
New cards

method to dequeue from a Deque

pollFirst()

25
New cards

method to peek the first item in a Deque

peekFirst()

26
New cards

method to push an item onto a Deque

push(item)

27
New cards

method to pop an item from a Deque

pop()

28
New cards

method to peek the top of a Deque

peek()

29
New cards

init a min heap named 'minHeap' that contains integers

PriorityQueue minHeap = new PriorityQueue<>();

30
New cards

method to add an item to a Heap

add(item)

31
New cards

method to pop the next item from a Heap

poll()

32
New cards

method to look at the next item in a Heap

peek()

33
New cards

init a maxHeap named 'maxHeap' containing integers

PriorityQueue maxHeap = new PriorityQueue<>(Collections.reverseOrder());