tagged [duplicates]

Java: Detect duplicates in ArrayList?

Java: Detect duplicates in ArrayList? How could I go about detecting (returning true/false) whether an ArrayList contains more than one of the same element in Java? Many thanks, Terry Forgot to mentio...

19 Feb at 01:14

How to find duplicate records in PostgreSQL

How to find duplicate records in PostgreSQL I have a PostgreSQL database table called "user_links" which currently allows the following duplicate fields: The unique constraint is currently the first f...

14 Apr at 17:18

Using LINQ to find duplicates across multiple properties

Using LINQ to find duplicates across multiple properties Given a class with the following definition: How can duplicate values be found in a MyTestClass[] array? For example, ``` MyTestClass[] items =...

9 Apr at 10:4

How do I find duplicates across multiple columns?

How do I find duplicates across multiple columns? So I want to do something like this sql code below: To produce the following, (but ignore where only name or only city match, it has to be on both col...

How do I use SELECT GROUP BY in DataTable.Select(Expression)?

How do I use SELECT GROUP BY in DataTable.Select(Expression)? I try to remove the duplicate rows by select a first row from every group. For Example I want a return: I tried following code but it didn...

16 Oct at 15:37

What is the most elegant way to find index of duplicate items in C# List

What is the most elegant way to find index of duplicate items in C# List I've got a `List` that contains duplicates and I need to find the indexes of each. What is the most elegant, efficient way othe...

27 Apr at 05:10

How to get duplicate items from a list using LINQ?

How to get duplicate items from a list using LINQ? I'm having a `List` like: I need to get the duplicate items in the list into a new list. Now I'm using a nested `for` loop to do this. The resulting ...

7 Jul at 11:12

TypeError: unhashable type: 'list' when using built-in set function

TypeError: unhashable type: 'list' when using built-in set function I have a list containing multiple lists as its elements If I use the built in set function to remove duplicates from this list, I ge...

28 Oct at 17:0

In Javascript, how do I check if an array has duplicate values?

In Javascript, how do I check if an array has duplicate values? > [Easiest way to find duplicate values in a javascript array](https://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate...

12 Sep at 08:34

Remove duplicate values from JS array

Remove duplicate values from JS array I have a very simple JavaScript array that may or may not contain duplicates. I need to remove the duplicates and put the unique values in a new array. I could po...

Find duplicate records in MySQL

Find duplicate records in MySQL I want to pull out duplicate records in a MySQL Database. This can be done with: Which results in: I would like to pull it so that it shows each row that is a duplicate...

12 May at 18:24

Removing duplicate objects in a list (C#)

Removing duplicate objects in a list (C#) So I understand how to remove duplicates in a list when it comes to strings and int, etc by using `Distinct()` from Linq. But how do you remove duplicates bas...

1 Dec at 20:48

Remove of duplicate strings from very big text file

Remove of duplicate strings from very big text file I have to remove duplicate strings from extremely big text file (100 Gb+) Since in memory duplicate removing is hopeless due to size of data, I have...

22 Mar at 03:50

C# remove duplicates from List<List<int>>

C# remove duplicates from List> I'm having trouble coming up with the most efficient algorithm to remove duplicates from `List>`, for example (I know this looks like a list of `int[]`, but just doing ...

8 Oct at 16:0

How do I (or can I) SELECT DISTINCT on multiple columns?

How do I (or can I) SELECT DISTINCT on multiple columns? I need to retrieve all rows from a table where 2 columns combined are all different. So I want all the sales that do not have any other sales t...

Fast ways to avoid duplicates in a List<> in C#

Fast ways to avoid duplicates in a List in C# My C# program generates random strings from a given pattern. These strings are stored in a list. As no duplicates are allowed I'm doing it like this: ``` ...

24 Jun at 14:57

Fastest way to duplicate an array in JavaScript - slice vs. 'for' loop

Fastest way to duplicate an array in JavaScript - slice vs. 'for' loop In order to duplicate an array in JavaScript: Which of the following is faster to use? ### Slice method ### For loop ``` for(var ...

Removing duplicates from a SQL query (not just "use distinct")

Removing duplicates from a SQL query (not just "use distinct") It's probably simple, here is my query: but this will only remove duplicates where a row has both the same u.name and p.pic_id. I want it...

7 Feb at 03:56

Does Distinct() method keep original ordering of sequence intact?

Does Distinct() method keep original ordering of sequence intact? I want to remove duplicates from list, without changing order of unique elements in the list. Jon Skeet & others have suggested to use...

16 Dec at 08:40

How do I do an integer list intersection while keeping duplicates?

How do I do an integer list intersection while keeping duplicates? I'm working on a Greatest Common Factor and Least Common Multiple assignment and I have to list the common factors. Intersection() wo...

15 Dec at 16:36

How to select records without duplicate on just one field in SQL?

How to select records without duplicate on just one field in SQL? I have a table with 3 columns like this: There are many records in this table. Some of them have `state` and some other don't. Now, i...

28 Apr at 07:2

How do I find duplicates in an array and display how many times they occurred?

How do I find duplicates in an array and display how many times they occurred? I'm working on a code that prints out duplicated integers from an array with the number of their occurrence. I'm not allo...

16 Apr at 15:20

Finding duplicate values in a SQL table

Finding duplicate values in a SQL table It's easy to find duplicates with one field: So if we have a table This query will give us John, Sam, Tom, Tom because they

28 Sep at 16:11

Java Scanner class reading strings

Java Scanner class reading strings I got the following code: ``` int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = i...

LINQ's Distinct() on a particular property

LINQ's Distinct() on a particular property I am playing with LINQ to learn about it, but I can't figure out how to use [Distinct](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.di...

18 Jan at 13:19