*/
package jalview.util;
-import java.util.*;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
public class DBRefUtils
{
{
return dbrefs;
}
- Hashtable srcs = new Hashtable();
- Vector res = new Vector();
+ Map<String, Integer> srcs = new HashMap<String, Integer>();
+ ArrayList<DBRefEntry> res = new ArrayList<DBRefEntry>();
for (int i = 0; i < sources.length; i++)
{
{
if (srcs.containsKey(dbrefs[i].getSource()))
{
- res.addElement(dbrefs[i]);
+ res.add(dbrefs[i]);
}
}
if (res.size() > 0)
{
DBRefEntry[] reply = new DBRefEntry[res.size()];
- for (int i = 0; i < res.size(); i++)
- {
- reply[i] = (DBRefEntry) res.elementAt(i);
- }
- return reply;
+ return res.toArray(reply);
}
res = null;
// there are probable memory leaks in the hashtable!
DbRefComp comparator)
{
if (ref == null || entry == null)
+ {
return null;
+ }
Vector rfs = new Vector();
for (int i = 0; i < ref.length; i++)
{
{
if ((refa.getMap() == null && refb.getMap() == null)
|| (refa.getMap() != null && refb.getMap() != null))
+ {
if ((refb.getMap().getMap() == null && refa.getMap().getMap() == null)
|| (refb.getMap().getMap() != null
&& refa.getMap().getMap() != null && refb
{
return true;
}
+ }
}
}
return false;