imsavva.com

Folder icon

Tags / collections

What data can be stored in a collection?

showPostImage(436047025)

Uncaught exception: the image was stolen by a UFO

You can store anything but primitives. To store primitives consider using wrappers (Integer for int, Double for double, etc…). For example, you can store your own classes: To store primitives: Notice, that you can add primitives, since it will be wrapped automatically:
Posted on
2016-03-19

What benefits does JCF provide?

showPostImage(-1054418192)

Uncaught exception: the image is currently being shown in a museum

Java Collections Framework provides the following benefits: Reduces programming effort: you don’t need to invent the wheel anymore, JCF provides useful data structures and algorithms. Increases program speed and quality: JCF provides high-performance, high-quality implementations of useful data structures and…
Posted on
2016-03-19

Java Collections hierarchy

(Self-explanatory image above)
Posted on
2016-03-19

Describing the Java Set collection interface

showPostImage(300406476)

Uncaught exception: the image is currently being shown in a museum

A Set is a Collection that cannot contain duplicates. The Set interface extends Collection interface but has no specific methods. It adds the restriction that duplicates are prohibited. This interface also adds a stronger contract on the behavior of the equals and the hashcode methods, allowing Set instances to be…
Posted on
2016-03-19

Describing the Java Map collection. Difference between other collections.

showPostImage(564019001)

Uncaught exception: the image was stolen by a UFO

Map is a collection that stores key-value pairs. A map cannot contain duplicate keys. What is the main difference between Map and other collections? The main difference between Map and other collections is that it contains key and value. It doesn’t inherit from Collection interface. The Map interface includes methods…
Posted on
2016-03-19

Describing the Java List collection interface

showPostImage(575624130)

Uncaught exception: the image is currently being shown in a museum

List is an ordered collection that can contain duplicates. In addition to the Collection interface methods, the List interface includes the following: Positional access: manipulating the elements by their index in the list. This includes methods such as: get, set, add, addAll, remove. Search: methods indexOf and…
Posted on
2016-03-19

Describing the Java Deque collection interface

A Deque is a double-ended-queue. It is a collection of elements that supports the insertion and removal of elements at both end points. It implements both Stack and Queue at the same time. This interface defines following methods: void addFirst(E e) void addLast(E e) boolean offerFirst(E e) boolean offerLast(E e) E…
Posted on
2016-03-19