Initial Checkin
This commit is contained in:
20
HashMapTest1.java
Normal file
20
HashMapTest1.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.*;
|
||||
|
||||
public class HashMapTest1 {
|
||||
public static void main(String []args) {
|
||||
String string1= "ABFED";
|
||||
String string2= "AFBHI";
|
||||
|
||||
HashMap<Character,Boolean> hm1 = new HashMap<>();
|
||||
|
||||
for (char theChar : string1.toCharArray()){
|
||||
hm1.put(theChar ,false);
|
||||
}
|
||||
|
||||
for (char theChar : string2.toCharArray()){
|
||||
if (hm1.containsKey(theChar)) {
|
||||
System.out.print(theChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user