No points, so I can only set this some
I have one to like aa there are three attributes name1, name2, name3, age and sex
LIST
The temp there are 1000 data
I want to do is now, if there are two records:, name1 name2, name3 is one, is considered a duplicate data. I want to take out to
Now can't use Java 8 steam, efficient logical way?
This is the cycle of 1000 * 1000 has a little low
CodePudding user response:
The name that a few field stitching as a HashMap key, determine whether there are key, should cycle can come out againCodePudding user response:
This decisive in the stream, direct temp. Stream. The filter (aa: : name1) equals (aa: : name2) & amp; & Aa: : name3 equals (aa: : name2).). Collect (Collectors. ToList ());CodePudding user response:
Originally I also is to use steam, quick and province codeThe last server JDK not above 1.8, cannot use the
Now, in writing,
By the way,
CodePudding user response:
Rewrite the aa hashCode equals, the list Set, and then turned back to the listCodePudding user response:
Turn the list set, and then turned back to the list, the set automatically to heavyCodePudding user response: