Collections Summary - Interfaces

Related Posts https://jurogrammer.tistory.com/172 Interfaces https://docs.oracle.com/javase/tutorial/collections/interfaces/index.html Overview Core collection interfaces encapsulate different types of collections. Therefore, you can manipulate different collections without worrying about the details. The collection interface can be considered the foundation of the Java Collection Framework. The Interface chapter will provide general guidelines for efficient use of collection interfaces. Important Notes Map is not a Collection Literally, it’s not. All Core collections are Generic When declaring a collection, you must specify the type that will go into the collection. Generics can verify at compile time whether the object being put into the collection is of the correct type. Java Platform does not provide interface variations To facilitate the management of numerous core collection interfaces, the Java Platform does not provide interface variations (e.g., interfaces with characteristics like immutable, fixed-size, append-only). Instead, modification operations are optional. That is, since not all operations are implemented, calling a specific operation may throw an UnsupportedOperationException. Therefore, this must be documented. In summary, if you need to implement a specific collection interface, implement only what you need. Don’t implement everything. ...

June 30, 2022