当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtil类代码示例

本文整理汇总了Java中org.chromium.base.CollectionUtil的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtil类的具体用法?Java CollectionUtil怎么用?Java CollectionUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CollectionUtil类属于org.chromium.base包,在下文中一共展示了CollectionUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: informRegistrationFailure

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
@Override
public void informRegistrationFailure(
        byte[] clientId, ObjectId objectId, boolean isTransient, String errorMessage) {
    Log.w(TAG, "Registration failure on " + objectId + " ; transient = " + isTransient
            + ": " + errorMessage);
    if (isTransient) {
      // Retry immediately on transient failures. The base AndroidListener will handle
      // exponential backoff if there are repeated failures.
        List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
        if (readRegistrationsFromPrefs().contains(objectId)) {
            register(clientId, objectIdAsList);
        } else {
            unregister(clientId, objectIdAsList);
        }
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:InvalidationClientService.java

示例2: informRegistrationStatus

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
@Override
public void informRegistrationStatus(
        byte[] clientId, ObjectId objectId, RegistrationState regState) {
    Log.d(TAG, "Registration status for " + objectId + ": " + regState);
    List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
    boolean registrationisDesired = readRegistrationsFromPrefs().contains(objectId);
    if (regState == RegistrationState.REGISTERED) {
        if (!registrationisDesired) {
            Log.i(TAG, "Unregistering for object we're no longer interested in");
            unregister(clientId, objectIdAsList);
        }
    } else {
        if (registrationisDesired) {
            Log.i(TAG, "Registering for an object");
            register(clientId, objectIdAsList);
        }
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:InvalidationClientService.java

示例3: createRegisterIntent

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
/**
 * Create an Intent that will start the invalidation listener service and
 * register for the specified types.
 */
public static Intent createRegisterIntent(Account account,
                                          boolean allTypes, Set<ModelType> types) {
    Intent registerIntent = new Intent(ACTION_REGISTER);
    String[] selectedTypesArray;
    if (allTypes) {
        selectedTypesArray = new String[]{ModelType.ALL_TYPES_TYPE};
    } else {
        selectedTypesArray = new String[types.size()];
        int pos = 0;
        for (ModelType type : types) {
            selectedTypesArray[pos++] = type.name();
        }
    }
    registerIntent.putStringArrayListExtra(EXTRA_REGISTERED_TYPES,
            CollectionUtil.newArrayList(selectedTypesArray));
    registerIntent.putExtra(EXTRA_ACCOUNT, account);
    return registerIntent;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:23,代码来源:InvalidationIntentProtocol.java

示例4: informRegistrationFailure

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
@Override
public void informRegistrationFailure(
        byte[] clientId, ObjectId objectId, boolean isTransient, String errorMessage) {
    Log.w(TAG, "Registration failure on " + objectId + " ; transient = " + isTransient
            + ": " + errorMessage);
    if (isTransient) {
      // Retry immediately on transient failures. The base AndroidListener will handle
      // exponential backoff if there are repeated failures.
      List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
      if (readRegistrationsFromPrefs().contains(objectId)) {
          register(clientId, objectIdAsList);
      } else {
          unregister(clientId, objectIdAsList);
      }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:InvalidationService.java

示例5: informRegistrationStatus

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
@Override
public void informRegistrationStatus(
        byte[] clientId, ObjectId objectId, RegistrationState regState) {
    Log.d(TAG, "Registration status for " + objectId + ": " + regState);
    List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
    boolean registrationisDesired = readRegistrationsFromPrefs().contains(objectId);
    if (regState == RegistrationState.REGISTERED) {
      if (!registrationisDesired) {
        Log.i(TAG, "Unregistering for object we're no longer interested in");
        unregister(clientId, objectIdAsList);
      }
    } else {
      if (registrationisDesired) {
        Log.i(TAG, "Registering for an object");
        register(clientId, objectIdAsList);
      }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:InvalidationService.java

示例6: createRegisterIntent

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
/**
 * Create an Intent that will start the invalidation listener service and
 * register for the specified types.
 */
public static Intent createRegisterIntent(Account account, Set<Integer> types) {
    Intent registerIntent = new Intent(ACTION_REGISTER);
    String[] selectedTypesArray = new String[types.size()];
    int pos = 0;
    for (Integer type : types) {
        selectedTypesArray[pos++] = ModelTypeHelper.toNotificationType(type);
    }
    registerIntent.putStringArrayListExtra(
            EXTRA_REGISTERED_TYPES, CollectionUtil.newArrayList(selectedTypesArray));
    registerIntent.putExtra(EXTRA_ACCOUNT, account);
    return registerIntent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:InvalidationIntentProtocol.java

示例7: DeviceSensors

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
protected DeviceSensors() {
    mOrientationSensorSets = CollectionUtil.newArrayList(DEVICE_ORIENTATION_SENSORS_A,
            DEVICE_ORIENTATION_SENSORS_B, DEVICE_ORIENTATION_SENSORS_C);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:DeviceSensors.java

示例8: trimVisibleNetworks

import org.chromium.base.CollectionUtil; //导入依赖的package包/类
@Nullable
@VisibleForTesting
static VisibleNetworks trimVisibleNetworks(@Nullable VisibleNetworks visibleNetworks) {
    if (visibleNetworks == null || visibleNetworks.isEmpty()) {
        return null;
    }
    // Trim visible networks to only include a limited number of visible not-conntected networks
    // based on flag.
    VisibleCell connectedCell = visibleNetworks.connectedCell();
    VisibleWifi connectedWifi = visibleNetworks.connectedWifi();
    Set<VisibleCell> visibleCells = visibleNetworks.allVisibleCells();
    Set<VisibleWifi> visibleWifis = visibleNetworks.allVisibleWifis();
    VisibleCell extraVisibleCell = null;
    VisibleWifi extraVisibleWifi = null;
    if (shouldExcludeVisibleWifi(connectedWifi)) {
        // Trim the connected wifi.
        connectedWifi = null;
    }
    // Select the extra visible cell.
    if (visibleCells != null) {
        for (VisibleCell candidateCell : visibleCells) {
            if (ApiCompatibilityUtils.objectEquals(connectedCell, candidateCell)) {
                // Do not include this candidate cell, since its already the connected one.
                continue;
            }
            // Add it and since we only want one, stop iterating over other cells.
            extraVisibleCell = candidateCell;
            break;
        }
    }
    // Select the extra visible wifi.
    if (visibleWifis != null) {
        for (VisibleWifi candidateWifi : visibleWifis) {
            if (shouldExcludeVisibleWifi(candidateWifi)) {
                // Do not include this candidate wifi.
                continue;
            }
            if (ApiCompatibilityUtils.objectEquals(connectedWifi, candidateWifi)) {
                // Replace the connected, since the candidate will have level. This is because
                // the android APIs exposing connected WIFI do not expose level, while the ones
                // exposing visible wifis expose level.
                connectedWifi = candidateWifi;
                // Do not include this candidate wifi, since its already the connected one.
                continue;
            }
            // Keep the one with stronger level (since it's negative, this is the smaller value)
            if (extraVisibleWifi == null || extraVisibleWifi.level() > candidateWifi.level()) {
                extraVisibleWifi = candidateWifi;
            }
        }
    }

    if (connectedCell == null && connectedWifi == null && extraVisibleCell == null
            && extraVisibleWifi == null) {
        return null;
    }

    return VisibleNetworks.create(connectedWifi, connectedCell,
            extraVisibleWifi != null ? CollectionUtil.newHashSet(extraVisibleWifi) : null,
            extraVisibleCell != null ? CollectionUtil.newHashSet(extraVisibleCell) : null);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:62,代码来源:GeolocationHeader.java


注:本文中的org.chromium.base.CollectionUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。