package com.bytedance.ies.nle.editor_jni;

import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.AbstractMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class MapStrStr extends AbstractMap<String, String> {
    public transient boolean LIZ;
    public transient long LIZIZ;

    static {
        Covode.recordClassIndex(29765);
    }

    public static class Iterator {
        public transient long LIZ;
        public transient boolean LIZIZ = true;

        static {
            Covode.recordClassIndex(29767);
        }

        public void finalize() {
            LIZJ();
        }

        public final String LIZIZ() {
            MethodCollector.i(18694);
            String MapStrStr_Iterator_getValue = NLEEditorJniJNI.MapStrStr_Iterator_getValue(this.LIZ, this);
            MethodCollector.o(18694);
            return MapStrStr_Iterator_getValue;
        }

        public final Iterator LIZ() {
            MethodCollector.i(18658);
            Iterator iterator = new Iterator(NLEEditorJniJNI.MapStrStr_Iterator_getNextUnchecked(this.LIZ, this));
            MethodCollector.o(18658);
            return iterator;
        }

        private synchronized void LIZJ() {
            MethodCollector.i(18655);
            long j = this.LIZ;
            if (j != 0) {
                if (this.LIZIZ) {
                    this.LIZIZ = false;
                    NLEEditorJniJNI.delete_MapStrStr_Iterator(j);
                }
                this.LIZ = 0;
            }
            MethodCollector.o(18655);
        }

        public static long LIZ(Iterator iterator) {
            if (iterator == null) {
                return 0;
            }
            return iterator.LIZ;
        }

        public Iterator(long j) {
            this.LIZ = j;
        }

        public final void LIZ(String str) {
            MethodCollector.i(18696);
            NLEEditorJniJNI.MapStrStr_Iterator_setValue(this.LIZ, this, str);
            MethodCollector.o(18696);
        }

        public final boolean LIZIZ(Iterator iterator) {
            MethodCollector.i(18693);
            Iterator iterator2 = iterator;
            boolean MapStrStr_Iterator_isNot = NLEEditorJniJNI.MapStrStr_Iterator_isNot(this.LIZ, this, LIZ(iterator2), iterator2);
            MethodCollector.o(18693);
            return MapStrStr_Iterator_isNot;
        }
    }

    public void finalize() {
        LIZ();
    }

    public MapStrStr() {
        this(NLEEditorJniJNI.new_MapStrStr__SWIG_0());
        MethodCollector.i(11694);
        MethodCollector.o(11694);
    }

    public void clear() {
        MethodCollector.i(11696);
        NLEEditorJniJNI.MapStrStr_clear(this.LIZIZ, this);
        MethodCollector.o(11696);
    }

    public boolean isEmpty() {
        MethodCollector.i(11695);
        boolean MapStrStr_isEmpty = NLEEditorJniJNI.MapStrStr_isEmpty(this.LIZIZ, this);
        MethodCollector.o(11695);
        return MapStrStr_isEmpty;
    }

    public int size() {
        MethodCollector.i(11006);
        int MapStrStr_sizeImpl = NLEEditorJniJNI.MapStrStr_sizeImpl(this.LIZIZ, this);
        MethodCollector.o(11006);
        return MapStrStr_sizeImpl;
    }

    private Iterator LIZIZ() {
        MethodCollector.i(11698);
        Iterator iterator = new Iterator(NLEEditorJniJNI.MapStrStr_end(this.LIZIZ, this));
        MethodCollector.o(11698);
        return iterator;
    }

    private synchronized void LIZ() {
        MethodCollector.i(10800);
        long j = this.LIZIZ;
        if (j != 0) {
            if (this.LIZ) {
                this.LIZ = false;
                NLEEditorJniJNI.delete_MapStrStr(j);
            }
            this.LIZIZ = 0;
        }
        MethodCollector.o(10800);
    }

    public Set<Map.Entry<String, String>> entrySet() {
        MethodCollector.i(11471);
        HashSet hashSet = new HashSet();
        Iterator LIZIZ2 = LIZIZ();
        for (Iterator iterator = new Iterator(NLEEditorJniJNI.MapStrStr_begin(this.LIZIZ, this)); iterator.LIZIZ(LIZIZ2); iterator = iterator.LIZ()) {
            AnonymousClass1 r0 = new Map.Entry<String, String>() {
                public Iterator LIZ;

                static {
                    Covode.recordClassIndex(29766);
                }

                public final /* synthetic */ Object getValue() {
                    return this.LIZ.LIZIZ();
                }

                public final /* synthetic */ Object getKey() {
                    MethodCollector.i(18478);
                    Iterator iterator = this.LIZ;
                    String MapStrStr_Iterator_getKey = NLEEditorJniJNI.MapStrStr_Iterator_getKey(iterator.LIZ, iterator);
                    MethodCollector.o(18478);
                    return MapStrStr_Iterator_getKey;
                }

                public final /* synthetic */ Object setValue(Object obj) {
                    String LIZIZ2 = this.LIZ.LIZIZ();
                    this.LIZ.LIZ((String) obj);
                    return LIZIZ2;
                }
            };
            r0.LIZ = iterator;
            hashSet.add(r0);
        }
        MethodCollector.o(11471);
        return hashSet;
    }

    public MapStrStr(long j) {
        this.LIZ = true;
        this.LIZIZ = j;
    }

    private Iterator LIZ(String str) {
        MethodCollector.i(11697);
        Iterator iterator = new Iterator(NLEEditorJniJNI.MapStrStr_find(this.LIZIZ, this, str));
        MethodCollector.o(11697);
        return iterator;
    }

    public boolean containsKey(Object obj) {
        MethodCollector.i(11255);
        if (!(obj instanceof String)) {
            MethodCollector.o(11255);
            return false;
        }
        boolean MapStrStr_containsImpl = NLEEditorJniJNI.MapStrStr_containsImpl(this.LIZIZ, this, (String) obj);
        MethodCollector.o(11255);
        return MapStrStr_containsImpl;
    }

    public /* synthetic */ Object get(Object obj) {
        if (!(obj instanceof String)) {
            return null;
        }
        Iterator LIZ2 = LIZ((String) obj);
        if (LIZ2.LIZIZ(LIZIZ())) {
            return LIZ2.LIZIZ();
        }
        return null;
    }

    public /* synthetic */ Object remove(Object obj) {
        MethodCollector.i(11928);
        if (obj instanceof String) {
            Iterator LIZ2 = LIZ((String) obj);
            if (LIZ2.LIZIZ(LIZIZ())) {
                String LIZIZ2 = LIZ2.LIZIZ();
                NLEEditorJniJNI.MapStrStr_removeUnchecked(this.LIZIZ, this, Iterator.LIZ(LIZ2), LIZ2);
                MethodCollector.o(11928);
                return LIZIZ2;
            }
        }
        MethodCollector.o(11928);
        return null;
    }

    public /* synthetic */ Object put(Object obj, Object obj2) {
        MethodCollector.i(12142);
        String str = (String) obj;
        String str2 = (String) obj2;
        Iterator LIZ2 = LIZ(str);
        if (LIZ2.LIZIZ(LIZIZ())) {
            String LIZIZ2 = LIZ2.LIZIZ();
            LIZ2.LIZ(str2);
            MethodCollector.o(12142);
            return LIZIZ2;
        }
        NLEEditorJniJNI.MapStrStr_putUnchecked(this.LIZIZ, this, str, str2);
        MethodCollector.o(12142);
        return null;
    }
}
