java - List of duplicate elements generator -


is there java library lets generate list of n elements of same value.

something this:

list<t> getduplicateelementlist(int size, t value); 

for example

library.getduplicateelementlist(3, "?"); 

would return 3 elements list, each element equal "?";

i need create placeholders in clause prepared statement.

you can use following:

list<string> list = collections.ncopies(6, "abc"); 

as example, give list 6 times "abc" element.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -