當前位置: 首頁>>代碼示例>>Java>>正文


Java LongSparseArray.append方法代碼示例

本文整理匯總了Java中android.support.v4.util.LongSparseArray.append方法的典型用法代碼示例。如果您正苦於以下問題:Java LongSparseArray.append方法的具體用法?Java LongSparseArray.append怎麽用?Java LongSparseArray.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.util.LongSparseArray的用法示例。


在下文中一共展示了LongSparseArray.append方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Conversation

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * This constructor is for working with cache.
 *
 * If contact was in cache we won't resolve contact
 * but will get directly from cache.
 *
 * @param context Context in order to use resolve some contact parts. (Like contact)
 * @param cursor cursor to get data from.
 * @param contactCache so save or retrieve contact without querying...
 */
public Conversation(Context context,Cursor cursor,LongSparseArray<ArrayList<Contact>> contactCache){
    this.recipientIds = cursor.getString(cursor.getColumnIndex(RECIPIENT_IDS));
    this.lastMessage = cursor.getString(cursor.getColumnIndex(LAST_MESSAGE));
    this.date = new Date(cursor.getLong(cursor.getColumnIndex(DATE)));
    this.messageRead = cursor.getInt(cursor.getColumnIndex(IS_READ)) == 1;
    this.id = cursor.getLong(cursor.getColumnIndex(THREAD_ID));

    ArrayList<Contact> cached= contactCache.get(id,null);

    if(cached == null){
        this.contacts = resolveContacts(context,recipientIds);
        // save in cache
        contactCache.append(id,contacts);
    }else{
        this.contacts = cached;
    }

}
 
開發者ID:Ioane5,項目名稱:GeoSMS-Release,代碼行數:29,代碼來源:Conversation.java

示例2: sparseArrayFromCursor

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * Returns data of the given cursor as {@link LongSparseArray} of item models mapped to theirs id.
 *
 * @return Sparse array of models with theirs corresponding data or empty array if the provided
 * cursor does not have any data available or it is {@code null}.
 */
@NonNull
public static <M extends EntityModel> LongSparseArray<M> sparseArrayFromCursor(@Nullable ItemCursor<M> cursor) {
	if (cursor == null || !cursor.moveToFirst()) {
		return new LongSparseArray<>(0);
	}
	final LongSparseArray<M> collection = new LongSparseArray<>(cursor.getCount());
	do {
		collection.append(CursorUtils.obtainLong(cursor, Column.Primary.COLUMN_NAME), cursor.getItem());
	} while (cursor.moveToNext());
	return collection;
}
 
開發者ID:universum-studios,項目名稱:android_database,代碼行數:18,代碼來源:EntityModelCollections.java

示例3: appendTo

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public SupportLongSparseArrayIterable<V> appendTo(final LongSparseArray<V> other) {

    for (final LongSparseArrayEntry<V> entry : this) {

        other.append(entry.getKey(), entry.getValue());
    }

    return this;
}
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:11,代碼來源:SupportLongSparseArrayIterableImpl.java

示例4: replaceValues

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public SupportLongSparseArrayIterable<V> replaceValues(final Translator<V, V> translator) {

    final LongSparseArray<V> array = mArray;

    for (final LongSparseArrayEntry<V> entry : this) {

        array.append(entry.getKey(), translator.translate(entry.getValue()));
    }

    return this;
}
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:13,代碼來源:SupportLongSparseArrayIterableImpl.java

示例5: toSparseArray

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public LongSparseArray<V> toSparseArray() {

    final LongSparseArray<V> array = new LongSparseArray<V>();

    for (final LongSparseArrayEntry<V> entry : this) {

        array.append(entry.getKey(), entry.getValue());
    }

    return array;
}
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:13,代碼來源:SupportLongSparseArrayIterableImpl.java

示例6: setUp

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {

    super.setUp();

    final LongSparseArray<String> array = new LongSparseArray<String>();

    for (int i = 0; i < 5; i++) {

        array.append(i, String.valueOf(i));
    }

    mArray = array;
}
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:15,代碼來源:SupportLongSparseArrayTest.java


注:本文中的android.support.v4.util.LongSparseArray.append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。