Alex Rivera | Logout

Any way to set max size of a collection?

Asked 2011-03-04T15:55:37.760
28

Is there any way to set a maximum size of a Collection in Java?

Edit
Report

1 Answer

9

ArrayBlockingQueue and LinkedBlockingQueue both support a maximum size. LinkedHashMap supports eviction of the oldest or least-recently-used items when reaching a maximum size.

What do you want it to do when the maximum size is reached?

answered 2011-03-04T16:30:08.380

Your Answer