Section 1

Preview this deck

What are the rules for the list interface? What are some example implementations?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (14)

Section 1

(14 cards)

What are the rules for the list interface? What are some example implementations?

Front

- Elements are ordered - Can contain duplicates Examples: - LinkedList - ArrayList - Stack - Vector

Back

What are the rules for the queue interface?

Front

- First-in, first-out (except PriorityQueue, which sorts by priority)

Back

What are the rules for the map interface? What are some implementations?

Front

- Contains key value pairs - doesn't allow for duplicates - examples are hashmap and tremap - treemap implements sortedmap

Back

How do you sort a list?

Front

Collections.sort(list, function(a,b))

Back

How do you get the next element from the queue?

Front

queue.poll() -> will remove the next element from the queue

Back

How do you create a queue in Java?

Front

Queue<int[]> queue = new LinkedList();

Back

What are the rules for the dequeue interface?

Front

- allows for last in first out and first in first out.

Back

What's the difference between System.out.print(String s) and System.out.println(String s)?

Front

System.out.println(String s) prints the string and then creates a new line.

Back

How do you create an array?

Front

int[] a = new int[n];

Back

How do you find the length of a list?

Front

size()

Back

What are the five interfaces the collection interface is the root interface for?

Front

Set List Queue Dequeue Map

Back

How do you create an array of arrays?

Front

Back

What are the rules for the set interface? What are some implementations?

Front

- Doesn't allow duplicates - HashSet (Hashing based) - TreeSet (balanced BST)

Back

What is the difference between ++x and x++?

Front

No difference if they are part of their own statement. If they are part of a larger statement, ++x will return the newest value of x and x++ will return the previous value.

Back