Define a fixed-size list in Java -
is possible define list fixed size that's 100? if not why isn't available in java?
yes,
commons library provides built-in fixedsizelist
not support add
, remove
, clear
methods (but set method allowed because not modify list
's size). in other words, if try call 1 of these methods, list still retain same size.
to create fixed size list, call
list<yourtype> fixed = fixedsizelist.decorate(arrays.aslist(new yourtype[100]));
Comments
Post a Comment