cache: add generated equals/hashCode to ArchiveFiles

This commit is contained in:
Adam
2017-09-11 16:38:50 -04:00
parent 94530bda30
commit cbfa298ac2

View File

@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import net.runelite.cache.io.InputStream;
import net.runelite.cache.io.OutputStream;
import org.slf4j.Logger;
@@ -42,6 +43,33 @@ public class ArchiveFiles
private final List<FSFile> files = new ArrayList<>();
private final Map<Integer, FSFile> fileMap = new HashMap<>();
@Override
public int hashCode()
{
int hash = 7;
hash = 67 * hash + Objects.hashCode(this.files);
return hash;
}
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final ArchiveFiles other = (ArchiveFiles) obj;
if (!Objects.equals(this.files, other.files))
{
return false;
}
return true;
}
public void addFile(FSFile file)
{
Preconditions.checkArgument(file.getFileId() != -1);