I have list of String.
List<String> elements= new ArrayList<String>();
when I wanna add new String
elements.add(“element”);
with name which is my arraylist I wanna to automatically rename to _[a-z…] as windows rename file when there are two same… so for example I have in arraylist “element” when I add element again I wanna to rename automatically to element_a … so
if (elements.contains("element")) {
something
}
is there some function in java ?
thx for help
No built-in function, but it’s not too hard. For example:
Outputs:
For best effect, you’d probably want to wrap this up into your own List type as appropriate.