package me.devsaki.hentoid.util;

import android.util.SparseArray;

import java.util.ArrayList;
import java.util.List;

import me.devsaki.hentoid.database.domains.Attribute;
import me.devsaki.hentoid.database.enums.AttributeType;

/**
 * Created by Shiro on 1/11/2016.
 */
public class AttributeMap extends SparseArray<List<Attribute>> {

    public void add(Attribute attributeItem) {

        int key = attributeItem.getType().getCode();

        List<Attribute> list = get(key);
        if (list == null) {
            list = new ArrayList<>();
            put(key, list);
        }
        list.add(attributeItem);
    }

    public void add(List<Attribute> attributeList) {
        for (Attribute item : attributeList) {
            add(item);
        }
    }

    public List<Attribute> get(AttributeType type) {
        return get(type.getCode());
    }
}

@@ -38,34 +38,28 @@
 ort 
-android.util.SparseArray;%0A
+java.util.ArrayList;
 %0Aimp
@@ -68,33 +68,31 @@
 t java.util.
-ArrayList
+HashMap
 ;%0Aimport jav
@@ -296,20 +296,31 @@
 nds 
-SparseArray%3C
+HashMap%3CAttributeType, 
 List
@@ -395,15 +395,56 @@
     
-int key
+List%3CAttribute%3E list;%0A        AttributeType type
  = a
@@ -465,26 +465,16 @@
 etType()
-.getCode()
 ;%0A%0A     
@@ -472,39 +472,60 @@
 );%0A%0A        
-List%3CAttribute%3E
+if (containsKey(type)) %7B%0A           
  list = get(
@@ -524,19 +524,20 @@
 t = get(
-key
+type
 );%0A     
@@ -543,25 +543,14 @@
     
-if (list == null)
+%7D else
  %7B%0A 
@@ -606,11 +606,12 @@
 put(
-key
+type
 , li
@@ -621,24 +621,25 @@
 ;%0A        %7D%0A
+%0A
         list
@@ -808,103 +808,7 @@
    %7D
-%0A%0A    public List%3CAttribute%3E get(AttributeType type) %7B%0A        return get(type.getCode());%0A    %7D
 %0A%7D%0A

Undo commit 867d75590748a655f02d48c487158b5c4dd4ae52