1/10
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the difference between a Set and a List in Java?
A Set is a collection that doesn't allow duplicates and where the order of elements is unimportant, while a List allows duplicates and maintains the order of elements based on their position.
What is a Map in Java?
A Map is a data structure that associates keys with values, allowing for quick retrieval of values using their respective keys. Unlike a Set, it can contain duplicate values but no duplicate keys.
What is the role of the Collection Interface?
The Collection interface serves as the root of the collection hierarchy, offering fundamental methods for storing and managing groups of objects, with different subtypes like List, Set, and Map having their own specific behaviors.
What are ArrayList and LinkedList used for in Java?
ArrayList is a dynamically resizing array implementation that provides fast random access to elements, whereas LinkedList is a linked data structure that allows for efficient insertion and deletion of elements at both ends but lacks random access.
How does HashSet work in Java?
HashSet stores its elements in a hash table, which uses hashing to store and retrieve elements, ensuring that there are no duplicates. The performance is largely affected by the hash table's initial capacity and load factor.
What is a TreeSet in Java?
TreeSet is a Set implementation that stores elements in a red/black binary search tree, ensuring that the elements are stored in sorted order and providing efficient access to them using a default iterator.
What is the significance of the Map Interface in Java?
The Map interface defines a collection of key-value pairs, where each key is unique and maps to exactly one value. It provides methods for inserting, removing, and querying elements by their keys.
How does the Collections class in Java assist with data manipulation?
The Collections class offers static methods for manipulating collections, such as counting occurrences, rotating elements, shuffling lists, and sorting them using algorithms like TimSort.
What is the role of ObservableList in JavaFX?
ObservableList is a JavaFX data structure that allows for real-time notifications of changes, making it suitable for use with UI components like ListView to automatically update the view when the underlying data changes.
When should you use a HashSet or TreeSet?
A HashSet is typically used when you need a collection with no duplicates and don't care about the order of elements. A TreeSet is useful when you need the elements to be sorted.
What is the Model-View-Controller (MVC) pattern?
MVC is a software architectural pattern that separates an application into three interconnected components: the Model (data and logic), the View (UI), and the Controller (manages interaction between Model and View)