Java Collections API

Ace your homework & exams now with Quizwiz!

List

-stored orderly -Since List is an interface, objects cannot be created of the type list. We always need a class that extends this list in order to create an object

TreeSet

Add, remove, contains - O (log n)

HashSet

Add, remove, contains - O(1)

ArrayList

ArrayList can grow/shrink, is dynamic -you don't have to define its size at creation Accessed using set of methods and can modify. Add, get - O(1) Remove - O(n)

Array

Fixed size Members accessed with [ ] Not a part of the collections interface, but is a part of Java CONTAINS: - Objects - primitives

HashMap

Not synchronized Basic implementation of the map interface Stores the data in (Key, value) pairs and you can access them by an index of another type. you call the key to get the value. dictionary example put, remove, get, containskey - O(1)

Set

Set does not allow duplicates (its members are unique) - unordered -This interface contains the methods inherited from the Collection interface and adds a feature that restricts the insertion of the duplicate elements.

HashTable

Synchronized Stores key/value pairs in a hash able When using a Hashtable, specify an object is used as a key and that value you want is linked to that key. The key is hashed and the resulting hash code is used as the index at which the value is stored within the table.


Related study sets

chapter 3 psychology human development

View Set

Chapter 2 - The Professional Dental Assistant

View Set

Mod 1 Week 4 Quiz Review (Bible)

View Set