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


Java IterableUtils.find方法代码示例

本文整理汇总了Java中org.apache.commons.collections4.IterableUtils.find方法的典型用法代码示例。如果您正苦于以下问题:Java IterableUtils.find方法的具体用法?Java IterableUtils.find怎么用?Java IterableUtils.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections4.IterableUtils的用法示例。


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

示例1: removeAll

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Override
public void removeAll(Collection<byte[]> removing) {
    awaitInit();
    Set<Long> removed = new HashSet<>();
    for(final Map.Entry<Long, byte[]> e : hashes.entrySet()) {
        byte[] hash = IterableUtils.find(removing, hash1 -> FastByteComparisons.compareTo(hash1, 0, 32, e.getValue(), 0, 32) == 0);
        if(hash != null) {
            removed.add(e.getKey());
        }
    }
    index.removeAll(removed);
    for(Long idx : removed) {
        hashes.remove(idx);
    }
    dbCommit();
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:17,代码来源:HashStoreImpl.java

示例2: getObjectName

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
protected static ObjectName getObjectName(final MBeanServerConnection connection, final String remoteContext,
                                          final Class objectClass) throws IOException {
    Set<ObjectName> names = connection.queryNames(null, null);
    return IterableUtils.find(names, o -> {
        if (!Objects.equals(remoteContext, o.getDomain())) {
            return false;
        }

        MBeanInfo info;
        try {
            info = connection.getMBeanInfo(o);
        } catch (Exception e) {
            throw new JmxControlException(e);
        }
        return Objects.equals(objectClass.getName(), info.getClassName());
    });
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:JmxConnectionHelper.java

示例3: updateInputFileStatus

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
    * Update the state of input files.
    * Change the state value for the input file specified. If the name is not
associated with any input file nothing happen.
<p>
There is not check on the file existence and real state which
is delegated to the caller object.
    *
    * @param name File name
    * @param aStatus New state
    */
   public final void updateInputFileStatus(
           final String name, final TaskFile.FILESTATUS aStatus) {

       TaskFileInput tfi = IterableUtils.find(inputFiles,
               new Predicate<TaskFileInput>() {
           @Override
           public boolean evaluate(final TaskFileInput t) {
               return t.getName().equals(name);
           }
       });
       if (tfi != null) {
           tfi.setStatus(aStatus);
           lastChange = new Date();
           setChanged();
           notifyObservers();
       }
   }
 
开发者ID:FutureGateway,项目名称:APIServer,代码行数:29,代码来源:Task.java

示例4: updateOutputFile

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
    * Update the state of input files.
    * Change the state value for the input file specified. If the name is not
associated with any input file nothing happen.
<p>
There is not check on the file existence and real state which
is delegated to the caller object.
    *
    * @param name File name
    * @param aStatus New state
    * @param url Url to retrieve the file. If null the download is managed by
    * the task service so the url will be under the the task resource url.
    */
   public final void updateOutputFile(
           final String name, final TaskFile.FILESTATUS aStatus,
           final String url) {

       TaskFileOutput tfo = IterableUtils.find(outputFiles,
               new Predicate<TaskFileOutput>() {
           @Override
           public boolean evaluate(final TaskFileOutput t) {
               return t.getName().equals(name);
           }
       });
       if (tfo != null) {
           tfo.setStatus(aStatus);
           tfo.setUrl(url);
           lastChange = new Date();
           setChanged();
           notifyObservers();
       }
   }
 
开发者ID:FutureGateway,项目名称:APIServer,代码行数:33,代码来源:Task.java

示例5: findField

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
public Value findField(final String fieldName){

        Value value;

        value = IterableUtils.find(this, new Predicate<Value>() {
            @Override
            public boolean evaluate(Value object) {
                return object.getMetadata().getName().equals(fieldName);
            }
        });

        return value;
    }
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:14,代码来源:Record.java

示例6: getPermissionVariant

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
public AttributePermissionVariant getPermissionVariant(final String attribute) {
    AttributeTarget attrTarget = IterableUtils.find(getPermissions(),
            object -> object != null && attribute.equals(object.getId()));
    if (attrTarget != null)
        return attrTarget.getPermissionVariant();
    else
        return null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:MultiplePermissionTarget.java

示例7: assignPermissionVariant

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
public void assignPermissionVariant(final String attribute, AttributePermissionVariant permissionVariant) {
    AttributeTarget attrTarget = IterableUtils.find(getPermissions(),
            object -> object != null && attribute.equals(object.getId()));
    if (attrTarget != null) {
        attrTarget.setPermissionVariant(permissionVariant);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:MultiplePermissionTarget.java

示例8: addDynamicAttributes

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
protected void addDynamicAttributes(Table component, Datasource ds, List<Table.Column> availableColumns) {
    if (metadataTools.isPersistent(ds.getMetaClass())) {
        Set<CategoryAttribute> attributesToShow =
                dynamicAttributesGuiTools.getAttributesToShowOnTheScreen(ds.getMetaClass(), context.getFullFrameId(), component.getId());
        if (CollectionUtils.isNotEmpty(attributesToShow)) {
            ds.setLoadDynamicAttributes(true);
            for (CategoryAttribute attribute : attributesToShow) {
                final MetaPropertyPath metaPropertyPath = DynamicAttributesUtils.getMetaPropertyPath(ds.getMetaClass(), attribute);

                Object columnWithSameId = IterableUtils.find(availableColumns,
                        o -> o.getId().equals(metaPropertyPath));

                if (columnWithSameId != null) {
                    continue;
                }

                final Table.Column column = new Table.Column(metaPropertyPath);

                column.setCaption(LocaleHelper.isLocalizedValueDefined(attribute.getLocaleNames()) ?
                        attribute.getLocaleName() :
                        StringUtils.capitalize(attribute.getName()));

                if (attribute.getDataType().equals(PropertyType.STRING)) {
                    column.setMaxTextLength(clientConfig.getDynamicAttributesTableColumnMaxTextLength());
                }

                if (attribute.getDataType().equals(PropertyType.ENUMERATION)) {
                    column.setFormatter(value ->
                            LocaleHelper.getEnumLocalizedValue((String) value, attribute.getEnumerationLocales())
                    );
                }
                component.addColumn(column);
            }
        }

        dynamicAttributesGuiTools.listenDynamicAttributesChanges(ds);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:39,代码来源:AbstractTableLoader.java

示例9: getAssociatedInfrastructure

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
 * Retrieves the associated infrastructure Id.
 * This is the infrastructure selected to execute the task among
 * the many the application can run on.
 *
 * @return The infrastructure
 */
@Transient
public Infrastructure getAssociatedInfrastructure() {
    if (applicationDetail == null) {
        return null;
    }
    return IterableUtils.find(
            applicationDetail.getInfrastructures(),
            new Predicate<Infrastructure>() {
        @Override
        public boolean evaluate(final Infrastructure t) {
            return t.getId().equals(getAssociatedInfrastructureId());
        }
    });
}
 
开发者ID:FutureGateway,项目名称:APIServer,代码行数:22,代码来源:Task.java

示例10: getParameterValue

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
 * Retrieves the parameter value from a list.
 * If the parameter has multiple definition, and so multiple values, the
 * first occurrence is returned.
 *
 * @param params The parameter list
 * @param name Parameter name
 * @param defaultValue Default value if the parameter is not defined
 * @return Parameter value or null is not present
 */
public static String getParameterValue(final List<Params> params,
        final String name, final String defaultValue) {
    Params tmpParam = IterableUtils.find(
            params, new Predicate<Params>() {
                @Override
                public boolean evaluate(final Params t) {
                    return t.getName().equals(name);
                }
            });
    if (tmpParam != null) {
        return tmpParam.getValue();
    }
    return defaultValue;
}
 
开发者ID:FutureGateway,项目名称:APIServer,代码行数:25,代码来源:Utilities.java

示例11: getWiFiChannelPairFirst

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Override
public Pair<WiFiChannel, WiFiChannel> getWiFiChannelPairFirst(String countryCode) {
    Pair<WiFiChannel, WiFiChannel> found = null;
    if (StringUtils.isNotBlank(countryCode)) {
        found = IterableUtils.find(getWiFiChannelPairs(), new WiFiChannelPredicate(countryCode));
    }
    return found == null ? SET1 : found;
}
 
开发者ID:VREMSoftwareDevelopment,项目名称:WiFiAnalyzer,代码行数:9,代码来源:WiFiChannelsGHZ5.java

示例12: getWiFiChannelByFrequency

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
public WiFiChannel getWiFiChannelByFrequency(int frequency) {
    Pair<WiFiChannel, WiFiChannel> found = null;
    if (isInRange(frequency)) {
        found = IterableUtils.find(wiFiChannelPairs, new FrequencyPredicate(frequency));
    }
    return found == null ? WiFiChannel.UNKNOWN : getWiFiChannel(frequency, found);
}
 
开发者ID:VREMSoftwareDevelopment,项目名称:WiFiAnalyzer,代码行数:8,代码来源:WiFiChannels.java

示例13: syncDatabase

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
public void syncDatabase(final DatabaseReader reader, DatabaseCounter counter, long lastSyncTimestamp, long currentSyncTimestamp) throws IOException {
    Database dbCurrentDatabase;
    Table dbCurrentTable;
    Record dbCurrentRecord;
    TableToSync currentTableToSync = null;
    Map<String, ValueMetadata> columns = null;
    String joinColumnName;
    ValueMetadata joinColumnMetadata;
    int elementType;

    Log.i(TAG, "start syncDatabase");

    // TODO check database name
    try {
        // Open the TX
        mDB.beginTransaction();

        while ((elementType = reader.nextElement()) != JSonDatabaseReader.END) {
            switch (elementType) {
                case JSonDatabaseReader.START_DB:
                    dbCurrentDatabase = reader.readDatabase();

                    // Check schema version
                    if (dbCurrentDatabase.getSchemaVersion() > mSchemaVersion) {
                        throw new SyncException(SyncStatus.Code.ERROR_NEW_SCHEMA_VERSION, "Find new schema version, need to update (found:" + dbCurrentDatabase.getSchemaVersion() + ", expected:" + mSchemaVersion + ")");
                    }

                    break;
                case JSonDatabaseReader.START_TABLE:
                    // Read the table and column metadata
                    dbCurrentTable = reader.readTable();

                    // Find the table to sync definition and rules
                    final String tableName = dbCurrentTable.getName();
                    currentTableToSync = IterableUtils.find(mTableToSync, new Predicate<TableToSync>() {
                        @Override
                        public boolean evaluate(TableToSync object) {
                            return object.getName().equals(tableName);
                        }
                    });

                    if (currentTableToSync == null) {
                        throw new SyncException(SyncStatus.Code.ERROR_SYNC_COULD_DB, "Unable to find table " + tableName + " into table definition");
                    }

                    columns = SqlLiteUtility.readTableMetadataAsMap(mDB, dbCurrentTable.getName());

                    // Add the records columns for join tables
                    for (JoinTable joinTable : currentTableToSync.getJoinTable()) {
                        joinColumnName = JOIN_COLUMN_PREFIX + joinTable.getJoinColumn();
                        joinColumnMetadata = new ValueMetadata(joinColumnName.toUpperCase(), ValueMetadata.TYPE_STRING);
                        columns.put(joinColumnName, joinColumnMetadata);
                    }

                    break;
                case JSonDatabaseReader.RECORD:
                    dbCurrentRecord = reader.readRecord(columns);
                    // Found record sync single record
                    if (!dbCurrentRecord.isEmpty()) {
                        syncRecord(currentTableToSync, dbCurrentRecord, counter, lastSyncTimestamp, currentSyncTimestamp);
                    }
                    break;
            }
        }
        // Commit the TX
        mDB.setTransactionSuccessful();
    } catch (Exception e) {
        throw e;
    } finally {
        mDB.endTransaction();
    }

    Log.i(TAG, "end syncDatabase tables: " + counter.getTableSyncedCount() + " recUpdated:" + counter.getRecordUpdated() + " recInserted:" + counter.getRecordInserted());
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:75,代码来源:SqlLiteManager.java

示例14: find

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
WiFiDetail find(@NonNull Series series) {
    return IterableUtils.find(cache.keySet(), new FindPredicate(series));
}
 
开发者ID:VREMSoftwareDevelopment,项目名称:WiFiAnalyzer,代码行数:4,代码来源:SeriesCache.java

示例15: findColor

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
private GraphColor findColor(long primaryColor) {
    return IterableUtils.find(getAvailableGraphColors(), new ColorPredicate(primaryColor));
}
 
开发者ID:VREMSoftwareDevelopment,项目名称:WiFiAnalyzer,代码行数:4,代码来源:GraphColors.java


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