Dynamic list comparison Java
1
0
Entering edit mode
10.1 years ago

I want to compare a dynamic set of lists. For example, I have a set of species(A,B,C) (this set of species is dynamic i.e. the length can be more) Each specie has a set of genes. e.g A = {gene a, gene b, gene c}, B = {gene a, gene b, gene d, gene e}, C = {gene a}. This set can be dynamic. I want to compare the set of genes to extract the common genes amongst these list.

What is the best way to solve this problem and how to create dynamic lists in Java?

Thank you.

gene • 1.9k views
ADD COMMENT
2
Entering edit mode
10.1 years ago
Asaf 10k

In python:

A=[a,b,c]

B=[a,b,d,e]

...

set(A) & set(B) & set(C)

in Java check out the Set interface and specifically the retainAll method

ADD COMMENT

Login before adding your answer.

Traffic: 1388 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6