All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bmd.android.collection.entry.ParcelableObjectSparseObjectEntryImpl Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bmd.android.collection.entry;

import android.os.Parcel;

/**
 * Implementation of {@link ParcelableObjectSparseObjectEntry}.
 * 

* Created by davide on 3/18/14. * * @param the key type. * @param the value type. */ class ParcelableObjectSparseObjectEntryImpl implements ParcelableObjectSparseObjectEntry { public static final Creator CREATOR = new Creator() { public ParcelableObjectSparseObjectEntryImpl createFromParcel(final Parcel parcel) { return new ParcelableObjectSparseObjectEntryImpl(parcel); } public ParcelableObjectSparseObjectEntryImpl[] newArray(final int size) { return new ParcelableObjectSparseObjectEntryImpl[size]; } }; private final K mKey; private final V mValue; public ParcelableObjectSparseObjectEntryImpl(final K key, final V value) { mKey = key; mValue = value; } @SuppressWarnings("unchecked") public ParcelableObjectSparseObjectEntryImpl(final Parcel parcel) { mKey = (K) parcel.readValue(null); mValue = (V) parcel.readValue(null); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(final Parcel parcel, final int i) { parcel.writeValue(mKey); parcel.writeValue(mValue); } @Override @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") public boolean equals(final Object o) { return SparseEntries.equal(this, o); } @Override public int hashCode() { return SparseEntries.hashCode(this); } @Override public K getKey() { return mKey; } @Override public V getValue() { return mValue; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy