473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

delete duplicate in an Array

Hi,
sorry to bother you with that.
is there any method available in java api to delete duplicates in an array? or do I have to write my own?
If I have to write my own, what'd be the best approach?

Thanks,
Aug 17 '09 #1
3 2646
JosAH
11,448 Expert 8TB
@rookTheCook
Arrays can not be shortened so what would you do with the duplicate elements that are supposedly removed from the array? Turn them into null values? Better turn your array into a List and feed that List to a Set (the last one can only contain unique elements). Finally turn that Set into a List again and voila.

Read the API documentation for the Collection framework and the Arrays utility class.

kind regards,

Jos
Aug 17 '09 #2
Hi,
thank JosAH. It really helped,

rook
Aug 17 '09 #3
JosAH
11,448 Expert 8TB
@rookTheCook
Good; you're welcome of course.

kind regards,

Jos
Aug 17 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robert | last post by:
Im a beginner in PHP and Im having a problem with this code. Im trying to remove duplicate elements from an array created via $_GET. I want users to be able to click on a link which sends an email...
3
by: Giloosh | last post by:
Hello, i need some help if possible... i have a payments table with over 500 records i want to run a query that searches through the table spotting out any duplicate ID#'s and Dates. So basically...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
11
by: Peter Olcott | last post by:
I have just built a class that provides the most useful subset of std::vector functionality for use by compilers that lack template capability. http://home.att.net/~olcott/std_vect.html ...
2
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
9
by: vbportal | last post by:
Hi, I would like to add BitArrays to an ArrayList and then remove any duplicates - can someone please help me forward. I seem to have (at leaset ;-) )2 problems/lack of understanding (see test...
7
by: cobolman | last post by:
I have a table with the following columns, NAME, TYPE, TAG And there may be 'duplicates' on name and type. How can I delete them?? I want to delete all with duplicate NAME and TYPE
3
by: rajeshkrsingh | last post by:
Hi friends, Step1- create table duplicate ( intId int, varName varchar(50) ) insert into duplicate(intId,varName) values(1,'rajesh') insert into duplicate(intId,varName) values(2,'raj12')...
4
by: ramdil | last post by:
Hi All I have table and it have around 90000 records.Its primary key is autonumber field and it has also have date column and name, then some other columns Now i have problem with the table,as my...
6
by: Dilip1983 | last post by:
Hi All, I want to delete duplicate records from a large table. There is one index(INDEX_U1) on 4 columns(col1,col2,col3,col4) which is in unusable state. First of all when i tried to rebuild...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.