Find Duplicate words in String java program

preview_player
Показать описание
Download Link -

Learn the concept of how you can find duplicate words from any given string, and also print how many times these string occur.

Рекомендации по теме
Комментарии
Автор

That's Really a Super Explanation ! Thanks a lot !

errahulrajocjp
Автор

Appreciate your efforts. Usually if the word get repeated means duplicate. "Repeated 1 time" needs to be corrected.

vij
Автор

Nicely explained and easily understandable for beginners

rangamohanprasad
Автор

Really explained well ... thanks a lot bro.

krishk
Автор

well said i seen 5 time your video for understand that code

sudarsana
Автор

I think the implementation of HashSet is more accurate for this question. HashSet never allows any duplicates. Here I will use an ArrayList to hold the repeated word. Here is my complete solution.

public class Abcd1 {
public static void main(String[] args) {
String str= "Gina Gini Protijayi Gini";

fix(str);
}

private static void fix(String str) {
List<String> list = new ArrayList<>();
Set<String> set = new HashSet<>();
String[] words = str.split("\\s+");

for( String word : words) {
if(set.contains(word))
}//for
System.out.println("list => " + list);
}
}
The output will be Gini which is the repeated word here.

soudiptadutta
Автор

Will u tell me why user defined object will locating address

vinithagundluri
Автор

can we use if(wordmap.containskey(str))?

jeneyify
Автор

I want some technical programming interview questions in java for freshers, tomorrow I have a interview please upload videos quickly

abiabinaya
Автор

what if i wanted to print only yes if there are duplicates and no if there are no duplicates

maherriyadh