Here you can find the source of uniqueIdNotIn(String prefix, Collection extends String> exclusions)
private static String uniqueIdNotIn(String prefix, Collection<? extends String> exclusions)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { private static String uniqueIdNotIn(String prefix, Collection<? extends String> exclusions) { StringBuilder sb = new StringBuilder(prefix); for (int counter = 0;; ++counter) { sb.setLength(prefix.length()); sb.append('.').append(counter); String candidate = sb.toString(); if (!exclusions.contains(candidate)) { return candidate; }/*from ww w . j a va 2 s . co m*/ } } }