mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Move the directory structure around to a more conventional one and start out on the 1.7 update.
3797 errors. We have a long way to go.
This commit is contained in:
1 parent
3a0de87a09
commit
ab47724473
1245 files changed
+1764
-5953
No files matched your search
@@ -0,0 +1,111 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class HashList<T> implements Iterable<T>
|
||||
{
|
||||
private ArrayList<T> list = new ArrayList<T>(256);
|
||||
|
||||
public boolean contains(T obj)
|
||||
{
|
||||
return list.contains(obj);
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
list.clear();
|
||||
}
|
||||
|
||||
public T get(int index)
|
||||
{
|
||||
if(index > size()-1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return list.get(index);
|
||||
}
|
||||
|
||||
public void add(T obj)
|
||||
{
|
||||
if(!list.contains(obj))
|
||||
{
|
||||
list.add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(int index, T obj)
|
||||
{
|
||||
if(!list.contains(obj))
|
||||
{
|
||||
if(index > size())
|
||||
{
|
||||
for(int i = size(); i <= index-1; i++)
|
||||
{
|
||||
list.add(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
list.add(index, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
public void remove(int index)
|
||||
{
|
||||
if(isEmpty() || index > size()-1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
list.remove(index);
|
||||
}
|
||||
|
||||
public void replace(int index, T obj)
|
||||
{
|
||||
if(get(index) != null)
|
||||
{
|
||||
remove(index);
|
||||
}
|
||||
|
||||
add(index, obj);
|
||||
}
|
||||
|
||||
public void remove(T obj)
|
||||
{
|
||||
list.remove(obj);
|
||||
}
|
||||
|
||||
public int indexOf(T obj)
|
||||
{
|
||||
return list.indexOf(obj);
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return list.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return list.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator iterator()
|
||||
{
|
||||
return list.iterator();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user