Conversion between array & Set, StringBuilder & String

Array & Set

Example:

Character vowel[] = { 'a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U' }; 
Set<Character> v = new HashSet<>(Arrays.asList(vowel)); 

StringBuilder & String

Example:

StringBuffer sb = new StringBuffer();
String str = sb.toString();

Leave a Reply