No video

#6 - How to Remove Duplicate Elements from an ArrayList using LinkedHashSet & JDK8 Streams

  Рет қаралды 58,699

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

#JavaCollectionFramework #ArrayList #NaveenAutomationLabs
In this video, I have explained, How to Remove Duplicate Elements from an ArrayList using LinkedHashSet & JDK8 Streams.
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
www.youtube.co...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/...
Paid courses (Recorded) videos:
naveenautomati...
For Java & Selenium - naveenautomatio...
For API (Manual + Automation) - naveenautomatio...

Пікірлер: 46
@hiteshpachakawade6428
@hiteshpachakawade6428 3 жыл бұрын
Thank you for this video sir. Looking forward for complete series. I watched all videos from this series till now.
@swarnasharma3836
@swarnasharma3836 3 жыл бұрын
Very informative video... It would be helpful if you could explain while making video about the scenarios where we can use these concepts in web testing...
@jayeshkumar2815
@jayeshkumar2815 6 ай бұрын
It's very easy Naveen sir clearly understandable wow Thank You
@tripurnachary
@tripurnachary 3 жыл бұрын
Second method is more useful and kindof update to the market standards ✊🏼
@sourovrahman1700
@sourovrahman1700 3 жыл бұрын
both are very good approach and I have no doubt on that ..I applied this on both HashSet an LinkedHashSet and it works .The difference is only insertion order where LinkedHashSet preserve insertion order .but why you mention only LinkedHashSet why not both??? is there any other issue Mr Naveen ??thank you very much.
@deepadhanyal5054
@deepadhanyal5054 3 жыл бұрын
I too have the same doubt?
@vaixnavi
@vaixnavi 3 жыл бұрын
I too have the same doubt
@simm5622
@simm5622 2 жыл бұрын
Beautifully explained 🏆🏆🏆
@vijaykaushal9311
@vijaykaushal9311 3 жыл бұрын
Hello Naveen, Thanks a lot for sharing your knowledge. Just one query I have one.. any specific reason for choosing LinkedHashSet over HashSet, as this can be done using HashSet as well. Kindly let me know.. Thanks in Advance!!
@ChethanCP
@ChethanCP 2 жыл бұрын
//Using distinct and iterator() List list = new ArrayList(Arrays.asList(1,34,2,67,1,9,2,56,34,11,55)); Iterator it =list.stream().distinct().iterator(); while(it.hasNext()) { System.out.println(it.next()); }
@vasanthjayakumar529
@vasanthjayakumar529 3 жыл бұрын
Informative! thanks for the video, Naveen!
@KaisarAnvar
@KaisarAnvar 3 жыл бұрын
Full support, upload more please
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Thanks for watching
@rishabagrawal6735
@rishabagrawal6735 3 жыл бұрын
Thank you Naveen If we print object of linkedhashset even then we are about to remove duplicate values. Why do we create new arraylist again ?
@chetandhiman4735
@chetandhiman4735 2 жыл бұрын
Its because we want array list at the end after remove value
@kunalbiswas9482
@kunalbiswas9482 3 жыл бұрын
First of all super content . Learn something new everytime i start a playlist :) I faced the same question in hacker rank . i used 2 for loops to iterate and remove the duplicate elements from the Integer arrayList , but the code could only pass 7 out of 10 data input scenarios . But if i use the any of 2 methods in video all 10 data input scenarios are passed . Could you please explain as to how using these 2 methods would handle any sort of input as compared to using regular for loops .
@mahalakshmi2998
@mahalakshmi2998 4 ай бұрын
Yes it would be good ,,, if we get an explanation for this question
@kalyaniacharekar4808
@kalyaniacharekar4808 2 жыл бұрын
Thanks Naveen ..
@ashishsaxena5587
@ashishsaxena5587 3 жыл бұрын
Very nice
@doublehit1
@doublehit1 3 жыл бұрын
I have a query. why use LinkedHashSet. why not HashSet ? hashset has better performance in retrieving elements. Any specific reason ?
@ankeshkumar1299
@ankeshkumar1299 3 жыл бұрын
Gained a good knowledge. :)
@baubaudinamo
@baubaudinamo 3 жыл бұрын
Nice!
@TrickShotHeroes90
@TrickShotHeroes90 3 жыл бұрын
if i want to prinnt duplicates how to do that
@socialmedia434
@socialmedia434 3 жыл бұрын
do we have to use LinkedHashSet, or can we just use HashSet?
@sagarnayak3628
@sagarnayak3628 3 жыл бұрын
If order is not of concern, you can use HashSet. LinkedHashSet maintains original(insertion) order.
@SameerKumar-yu1xi
@SameerKumar-yu1xi 2 жыл бұрын
Hello Naveen.... In 1st approach we can also use HashSet right .. The only purpose of using LinkedHashSet is to maintain output in ordered....right? Or any other reason are there?
@gugapriyaramasamy6200
@gugapriyaramasamy6200 Жыл бұрын
Both HashSet and LinkedHashSet maintains the order
@gayus7443
@gayus7443 Жыл бұрын
@@gugapriyaramasamy6200 HashSet does not maintain order
@maneeshbuddha8253
@maneeshbuddha8253 Жыл бұрын
without creating arraylist after linkedhashset,we are geeting result in sysout.
@user-su1pt5eu5e
@user-su1pt5eu5e 3 жыл бұрын
Sir here as we use LInkedHashSet on ArrayList Should the order be maintained or not?
@kapilrana2361
@kapilrana2361 3 жыл бұрын
Hi Brother, Just one query why can't we create an object of HashSet... I mean: ArrayList remduplicate = new ArrayList(Arrays.asList(1,2,3,4,5,1,2,3,4)); Set uniqset = new HashSet(remduplicate); ArrayList uniqueArlist = new ArrayList(uniqset); System.out.println("Unique value in array list " + uniqueArlist); Any specific reason to create an object of LinkedHashSet??
@hetshah1440
@hetshah1440 3 жыл бұрын
If you create a HashSet then it might be possible that output is not in the form of order which you insert.
@priyotoshmaji2859
@priyotoshmaji2859 3 жыл бұрын
But why linkedhashset not only hashset can you explain pls?
@blablagswjsvsns134
@blablagswjsvsns134 3 жыл бұрын
We can use hashmap . It's not better than these 2 ways but we can use that too.😀
@django4084
@django4084 3 жыл бұрын
How? What's the key here? the numbers? Seems too much of a workaround.
@poojarajput827
@poojarajput827 7 ай бұрын
Hashset internally use hashmap to remove duplicates.
@tetricko
@tetricko Жыл бұрын
this does not work for Strings how do we do it for strings
@ramasudha6033
@ramasudha6033 3 жыл бұрын
can you explain about passing parameters sir
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Like?
@ramasudha6033
@ramasudha6033 3 жыл бұрын
Through the multiple classes how to we can pass parameters sir .
@onetechlab8697
@onetechlab8697 Жыл бұрын
Why we are using linkedHashSet? Why not just HashSet ?
@sharathchandraracha6379
@sharathchandraracha6379 Жыл бұрын
Linkedhashset preserves insertion order but hashset will not preserve
@nitakumari3517
@nitakumari3517 3 жыл бұрын
ArrayList arr = new ArrayList(Arrays.asList(1,1,2,2,3,34,5,6,7,8,9,10,11,21,13,14,151,1435)); Set UpdatedRecord = new HashSet(arr); Iterator it= UpdatedRecord.iterator(); while(it.hasNext()){ System.out.print(it.next()+ " "); }
@barunpundhir2898
@barunpundhir2898 4 ай бұрын
in the LinkedHashSet...why we are not printing linkedHasSet it will give array list with no duplicate value. we are printing extra line "ArrayList numbersListWithoutDuplicates = new ArrayList(linkedHashSet);" @naveen
#7 - How to Compare Two ArrayLists in Java
10:31
Naveen AutomationLabs
Рет қаралды 52 М.
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 13 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 3,6 МЛН
Fortunately, Ultraman protects me  #shorts #ultraman #ultramantiga #liveaction
00:10
#8 - What is HashMap? How to iterate HashMap?
19:57
Naveen AutomationLabs
Рет қаралды 59 М.
Java Program to Remove Duplicate Elements from Sorted Array
5:43
Programming Tutorials
Рет қаралды 142 М.
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 13 МЛН