Deleting Duplicate Element Using HashSet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import java.util.*;
public class Main {
public static void main(String args[]){
String[] fav = {"red","red","apple", "apple", "hallo"};
Set<String> mySet = new HashSet<String>();
Collections.addAll(mySet,fav);
System.out.println(mySet);
}
}
|
cs |
result / 결과
1
|
[red, apple, hallo]
|
cs |
'Study > Java Programming' 카테고리의 다른 글
Java String Instance Practice Example #1 (0) | 2019.04.28 |
---|---|
Java Usage ArrayList Example #1 (0) | 2019.04.28 |
Java programming practice; Tax (0) | 2018.10.06 |
Java Programming Practice #1 (0) | 2018.10.06 |
[Java Programming] Java return, 자바 리턴값 배우기 (0) | 2018.09.09 |