File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is use of Backed Collection in java

 
Prateek Kumar Singh
Ranch Hand
Posts: 30
Eclipse IDE Hibernate Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
can any body elaborate that what is use of Backed Collection in java.

Prateek Singh
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Backed collections, like the ones you get from SortedSet's headSet(), subSet() and tailSet() methods, or SortedMap's headMap(), subMap(), and tailMap()'s methods, are intented as views of a particular section of the larger collection - according to their API documentation. These view collections are conceptually similar to updatable database views, and offer some of the same advantages. Their memory footprint is small, because no data is actually duplicated, as all references point to the same objects, and they can logically partition a large collection making it easier to work with relevant data. A "write-through" view isn't always what you want, though, so it's very important to be aware of that behavior. Some times you actually need a defensive copy of a collection, and directly exposing the results of the methods mentioned earlier would of course violate that. Another kind of backing is what you get when using Arrays.asList() where the returned List is backed by an array.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic