java.util.Collections#EMPTY_LIST源码实例Demo

下面列出了java.util.Collections#EMPTY_LIST 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: helix   文件: Message.java
/**
 * Attach a relayed message and its destination participant to this message.
 * WARNNING: only content in SimpleFields of relayed message will be carried over and sent,
 * all contents in either ListFields or MapFields will be ignored.
 * @param instance destination participant name
 * @param message relayed message.
 */
public void attachRelayMessage(String instance, Message message) {
  List<String> relayList = _record.getListField(Attributes.RELAY_PARTICIPANTS.name());
  if (relayList == null) {
    relayList = Collections.EMPTY_LIST;
  }
  Set<String> relayParticipants = new LinkedHashSet<>(relayList);
  relayParticipants.add(instance);
  Map<String, String> messageInfo = message.getRecord().getSimpleFields();
  messageInfo.put(Attributes.RELAY_MSG_ID.name(), message.getId());
  messageInfo.put(Attributes.MSG_SUBTYPE.name(), MessageType.RELAYED_MESSAGE.name());
  messageInfo.put(Attributes.RELAY_FROM.name(), getTgtName());
  messageInfo.put(Attributes.EXPIRY_PERIOD.name(), String.valueOf(RELAY_MESSAGE_DEFAULT_EXPIRY));
  _record.setMapField(instance, messageInfo);
  _record.setListField(Attributes.RELAY_PARTICIPANTS.name(),
      Lists.newArrayList(relayParticipants));
}
 
源代码2 项目: CameraColorPicker   文件: Palettes.java
/**
 * Get the {@link Palette}s of the user.
 *
 * @param sharedPreferences a {@link android.content.SharedPreferences} from which the {@link Palette}s will be retrieved.
 * @return a {@link java.util.List} of {@link Palette}s.
 */
@SuppressWarnings("unchecked")
private static List<Palette> getSavedColorPalettes(SharedPreferences sharedPreferences) {
    final String jsonColorPalettes = sharedPreferences.getString(KEY_SAVED_COLOR_PALETTES, "");

    // No saved colors were found.
    // Return an empty list.
    if ("".equals(jsonColorPalettes)) {
        return Collections.EMPTY_LIST;
    }

    // Parse the json into colorItems.
    final List<Palette> palettes = GSON.fromJson(jsonColorPalettes, COLOR_PALETTE_LIST_TYPE);

    // Sort the color items chronologically.
    Collections.sort(palettes, CHRONOLOGICAL_COMPARATOR);
    return palettes;
}
 
源代码3 项目: openregistry   文件: NoOpReconciler.java
public ReconciliationResult reconcile(final ReconciliationCriteria reconciliationCriteria) {
    return new ReconciliationResult() {
        public ReconciliationType getReconciliationType() {
            return ReconciliationType.NONE;
        }

        public List<PersonMatch> getMatches() {
            return Collections.EMPTY_LIST;
        }

        public boolean noPeopleFound() {
            return true;
        }

        public boolean personAlreadyExists() {
            return false;
        }

        public boolean multiplePeopleFound() {
            return false;  
        }

        public void setReconciliationFeedback(String feedback){
        }

        public String getReconciliationFeedback(){
            return "feedback";
        }
    };
}
 
源代码4 项目: birt   文件: ParameterDialog.java
private List getColumnValueList( )
{
	try
	{
		if ( columnChooser.getText( ) == null
				|| columnChooser.getText( ).equals( "" ) ) //$NON-NLS-1$
		{
			MessageDialog.openWarning( getShell( ),
					Messages.getString( "ParameterDialog.emptyColumnValueExpression.title" ), //$NON-NLS-1$
					Messages.getString( "ParameterDialog.emptyColumnValueExpression.message" ) ); //$NON-NLS-1$
			columnChooser.forceFocus( );
			return Collections.EMPTY_LIST;
		}
		ArrayList valueList = new ArrayList( );

		//Flow mode PARAM_EVALUATION_FLOW is propagated to data engine execution to exclude filters defined on data set.
		valueList.addAll( SelectValueFetcher.getSelectValueList(
				ExpressionButtonUtil.getExpression( columnChooser ),
				getDataSetHandle( ),
				DataEngineFlowMode.PARAM_EVALUATION_FLOW ) );
		java.util.Collections.sort( valueList );
		return valueList;
	}
	catch ( Exception e )
	{
		ExceptionHandler.handle( e );
		return Collections.EMPTY_LIST;
	}
}
 
源代码5 项目: rapidoid   文件: Field.java
protected Collection<?> getOptionsOfType(Class<?> clazz) {
	if (Cls.kindOf(clazz) == TypeKind.UNKNOWN && Beany.hasProperty(clazz, "id")) {
		return Collections.EMPTY_LIST; // FIXME use magic?
	} else {
		return Collections.EMPTY_LIST;
	}
}
 
源代码6 项目: seldon-server   文件: ItemStorage.java
public FilteredItems retrieveRecentlyAddedItemsWithTags(final String client, final int numItems, final int tagAttrId, final Set<String> tags, final int tagsKey){
    final String key = MemCacheKeys.getRecentItemsWithTags(client, tagAttrId, tagsKey, numItems);
    List<Long> retrievedItems = retrieveUsingJSON(key, numItems, new UpdateRetriever<List<Long>>() {
        @Override
        public List<Long> retrieve() throws Exception {
            return provider.getItemPersister(client).getRecentItemIdsWithTags(tagAttrId, tags, numItems);
        }
    }, new TypeReference<List<Long>>() {}, RECENT_ITEMS_EXPIRE_TIME);
    return new FilteredItems(retrievedItems==null? Collections.EMPTY_LIST : retrievedItems,SecurityHashPeer.md5(key));
}
 
源代码7 项目: quarkus-http   文件: JsrWebSocketServerTest.java
@Test
@Ignore("UT3 - P2")
public void testErrorHandling() throws Exception {


    ServerWebSocketContainer builder = new ServerWebSocketContainer(TestClassIntrospector.INSTANCE, DefaultServer.getEventLoopSupplier(), Collections.EMPTY_LIST, false, false);

    builder.addEndpoint(ServerEndpointConfig.Builder.create(ProgramaticErrorEndpoint.class, "/").configurator(new InstanceConfigurator(new ProgramaticErrorEndpoint())).build());
    deployServlet(builder);

    AnnotatedClientEndpoint c = new AnnotatedClientEndpoint();

    Session session = ContainerProvider.getWebSocketContainer().connectToServer(c, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));

    Assert.assertEquals("hi", ProgramaticErrorEndpoint.getMessage());
    session.getAsyncRemote().sendText("app-error");
    Assert.assertEquals("app-error", ProgramaticErrorEndpoint.getMessage());
    Assert.assertEquals("ERROR: java.lang.RuntimeException", ProgramaticErrorEndpoint.getMessage());
    Assert.assertTrue(c.isOpen());

    session.getBasicRemote().sendText("io-error");
    Assert.assertEquals("io-error", ProgramaticErrorEndpoint.getMessage());
    Assert.assertEquals("ERROR: java.lang.RuntimeException", ProgramaticErrorEndpoint.getMessage());
    Assert.assertTrue(c.isOpen());
    ((UndertowSession) session).forceClose();
    Assert.assertEquals("CLOSED", ProgramaticErrorEndpoint.getMessage());

}
 
源代码8 项目: reef   文件: DeadlockInfo.java
/**
 * Get a list of monitor locks that were acquired by this thread at this stack element.
 * @param threadInfo The thread that created the stack element
 * @param stackTraceElement The stack element
 * @return List of monitor locks that were acquired by this thread at this stack element
 * or an empty list if none were acquired
 */
public List<MonitorInfo> getMonitorLockedElements(final ThreadInfo threadInfo,
                                                  final StackTraceElement stackTraceElement) {
  final Map<StackTraceElement, List<MonitorInfo>> elementMap = monitorLockedElements.get(threadInfo);
  if (null == elementMap) {
    return Collections.EMPTY_LIST;
  }

  final List<MonitorInfo> monitorList = elementMap.get(stackTraceElement);
  if (null == monitorList) {
    return Collections.EMPTY_LIST;
  }

  return monitorList;
}
 
源代码9 项目: litchi   文件: RedisHash.java
/**
 * 获取所有给定字段的值
 * @param key
 * @param fields
 * @return
 */
@SuppressWarnings("unchecked")
public List<String> mget(String key, String... fields) {
	try {
		return jedis.hmget(key, fields);
	} catch (Exception e) {
		LOGGER.error("", e);
	} finally {
		if (autoClose) {
			close();
		}
	}
	return Collections.EMPTY_LIST;
}
 
源代码10 项目: kylin   文件: DefaultCuboidScheduler.java
@Override
public List<Long> getSpanningCuboid(long cuboid) {
    if (cuboid > max || cuboid < 0) {
        throw new IllegalArgumentException("Cuboid " + cuboid + " is out of scope 0-" + max);
    }

    List<Long> spanning = parent2child.get(cuboid);
    if (spanning == null) {
        return Collections.EMPTY_LIST;
    }
    return spanning;
}
 
源代码11 项目: bonita-studio   文件: ActivityName2EditPart.java
/**
* @generated
*/
@SuppressWarnings("rawtypes")
protected List getModelChildren() {
	return Collections.EMPTY_LIST;
}
 
源代码12 项目: Llunatic   文件: StandardCostManager.java
@SuppressWarnings("unchecked")
    private List<Repair> generateBackwardRepairs(EquivalenceClassForEGD equivalenceClass, Scenario scenario, IDatabase deltaDB, String stepId) {
        List<ViolationContext> violationContextsForBackward = extractViolationContextWithWitnessCells(equivalenceClass);
        if (violationContextsForBackward.isEmpty()) {
            return Collections.EMPTY_LIST;
        }
        if (violationContextsForBackward.size() > 10) {
            throw new ChaseException("Equivalence class is too big (" + violationContextsForBackward.size() + "). It is not possible to chase this scenario with standard cost manager: " + equivalenceClass);
        }
        List<Repair> result = new ArrayList<Repair>();
        Set<String> repairFingerprints = new HashSet<String>();
        if (logger.isDebugEnabled()) logger.debug("Generating backward repairs for equivalence class :" + equivalenceClass);
        GenericPowersetGenerator<Integer> powersetGenerator = new GenericPowersetGenerator<Integer>();
//        List<List<Integer>> powerset = powersetGenerator.generatePowerSet(CostManagerUtility.createIndexes(equivalenceClass.getSize()));
        List<List<Integer>> powerset = powersetGenerator.generatePowerSet(CostManagerUtility.createIndexes(violationContextsForBackward.size()));
        for (List<Integer> subsetIndex : powerset) {
            if (subsetIndex.isEmpty()) {
                continue;
            }
            Collections.reverse(subsetIndex);
            List<ViolationContext> backwardContexts = extractBackwardContexts(subsetIndex, violationContextsForBackward);
            if (logger.isDebugEnabled()) logger.debug("Generating backward repairs for subset indexes: " + subsetIndex);
            List<List<CellGroup>> backwardCellGroups = extractBackwardCellGroups(backwardContexts);
            if (backwardCellGroups == null) {
                //Backward is not allowed on some of the contexts
                if (logger.isDebugEnabled()) logger.debug("Cannot do backward on all contexts. Discarding");
                continue;
            }
            GenericListGenerator<CellGroup> listGenerator = new GenericListGenerator<CellGroup>();
            List<List<CellGroup>> backwardCombinations = listGenerator.generateListsOfElements(backwardCellGroups);
            for (List<CellGroup> backwardCombination : backwardCombinations) {
                if (logger.isDebugEnabled()) logger.debug("Generating repairs for backward combination " + backwardCombination);
                List<ViolationContext> forwardContext = extractForwardContext(backwardContexts, equivalenceClass);
                if (!checkConsistencyOfBackwardChanges(backwardCombination, backwardContexts, forwardContext, equivalenceClass)) {
                    if (logger.isTraceEnabled()) logger.debug("Cell group combination for backward is not consistent. Discarding " + backwardCombination);
                    continue;
                }
                if (!checkConsistencyOfForwardChanges(forwardContext, backwardContexts, equivalenceClass)) {
                    if (logger.isDebugEnabled()) logger.debug("Inconsistent subset. Discarding " + LunaticUtility.printViolationContextIDs(backwardContexts));
                    continue;
                }
                String repairFingerprint = generateRepairFingerprint(backwardCombination);
                if (repairFingerprints.contains(repairFingerprint)) {
                    if (logger.isDebugEnabled()) logger.debug("Duplicate repair fingerprint. Discarding " + repairFingerprint);
                    continue;
                }
                repairFingerprints.add(repairFingerprint);
                Repair repair = CostManagerUtility.generateRepairWithBackwards(forwardContext, backwardCombination, backwardContexts, scenario);
                if (logger.isDebugEnabled()) logger.debug("Generating repair for: \nForward contexts: " + forwardContext + "\nBackward groups: " + backwardCombination + "\n" + repair);
                result.add(repair);
            }
        }
        if (logger.isDebugEnabled()) logger.debug("########Backward repairs: " + result);
        return result;
    }
 
源代码13 项目: qpid-proton-j   文件: CloseType.java
@Override
protected List wrap(Close val)
{
    ErrorCondition error = val.getError();
    return error == null ? Collections.EMPTY_LIST : Collections.singletonList(error);
}
 
protected List getSelectedNonResources() {		
	return Collections.EMPTY_LIST;
}
 
源代码15 项目: bonita-studio   文件: ReceiveTaskLabel2EditPart.java
/**
* @generated
*/
@SuppressWarnings("rawtypes")
protected List getModelChildren() {
	return Collections.EMPTY_LIST;
}
 
源代码16 项目: spliceengine   文件: FirstLastValueFunctionNode.java
@Override
public List<ValueNode> getOperands() {
    return (operand != null ? Lists.newArrayList(operand) : Collections.EMPTY_LIST);
}
 
源代码17 项目: kogito-runtimes   文件: PackageDescr.java
public void addAccumulateImport(final AccumulateImportDescr importAccumulate) {
    if (this.accumulateImports == Collections.EMPTY_LIST) {
        this.accumulateImports = new ArrayList<AccumulateImportDescr>();
    }
    this.accumulateImports.add(importAccumulate);
}
 
源代码18 项目: birt   文件: DistinctValueSelector.java
private static List getSelectValueList1( Expression expression,
		ModuleHandle moduleHandle, DataSetHandle dataSetHandle,
		boolean useDataSetFilter, DataEngineFlowMode flowMode )
		throws BirtException
{
	ScriptExpression expr = null;
	DataSetHandle targetHandle = dataSetHandle;
	Map appContext = new HashMap( );
	DataSetPreviewer previewer = null;

	try
	{
		ModuleHandle targetModuleHandle = moduleHandle;
		if ( !useDataSetFilter )
		{
			targetModuleHandle = ( (Module) moduleHandle.copy( ) ).getModuleHandle( );
			SlotHandle dataSets = targetModuleHandle.getDataSets( );
			for ( int i = 0; i < dataSets.getCount( ); i++ )
			{
				if ( dataSetHandle.getName( ).equals( dataSets.get( i )
						.getName( ) ) )
				{
					targetHandle = (DataSetHandle) dataSets.get( i );
					targetHandle.clearProperty( IDataSetModel.FILTER_PROP );
					break;
				}
			}
		}
		previewer = new DataSetPreviewer( targetHandle,
				0,
				PreviewType.RESULTSET );
		
		DataModelAdapter adapter = new DataModelAdapter( new DataSessionContext( DataSessionContext.MODE_DIRECT_PRESENTATION,
				targetModuleHandle ) );
		expr = adapter.adaptExpression( expression );

		boolean startsWithRow = ExpressionUtility.isColumnExpression( expr.getText( ),
				true );
		boolean startsWithDataSetRow = ExpressionUtility.isColumnExpression( expr.getText( ),
				false );
		if ( !startsWithRow && !startsWithDataSetRow )
		{
			throw new DataException( Messages.getString( "SelectValueDialog.messages.info.invalidSelectVauleExpression" ) ); //$NON-NLS-1$
		}

		String dataSetColumnName = null;
		if ( startsWithDataSetRow )
		{
			dataSetColumnName = ExpressionUtil.getColumnName( expr.getText( ) );
		}
		else
		{
			dataSetColumnName = ExpressionUtil.getColumnBindingName( expr.getText( ) );
		}			
		
		ResourceIdentifiers identifiers = new ResourceIdentifiers( );
		String resouceIDs = ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS;					
		identifiers.setApplResourceBaseURI( DTPUtil.getInstance( ).getBIRTResourcePath( ) );
		identifiers.setDesignResourceBaseURI( DTPUtil.getInstance( ).getReportDesignPath( ) );
		appContext.put( resouceIDs,identifiers);
	
		AppContextPopulator.populateApplicationContext( targetHandle, appContext );
		previewer.open( appContext, getEngineConfig( targetHandle.getModuleHandle( ) ), flowMode );
		IResultIterator itr = previewer.preview( ) ;
		
		Set visitedValues = new HashSet( );
		Object value = null;
		
		while ( itr.next( ) )
		{
			// default is to return 10000 distinct value
			if ( visitedValues.size( ) > 10000 )
			{
				break;
			}
			value = itr.getValue( dataSetColumnName );
			if ( value != null && !visitedValues.contains( value ) )
			{
				visitedValues.add( value );
			}
		}

		if ( visitedValues.isEmpty( ) )
			return Collections.EMPTY_LIST;

		return new ArrayList( visitedValues );
	}
	finally
	{
		AppContextResourceReleaser.release( appContext );
		if ( previewer != null )
			previewer.close( );
	}
}
 
源代码19 项目: netbeans   文件: StackTraceSnapshotBuilder.java
private void processDiffs(int threadId, StackTraceElement[] oldElements, StackTraceElement[] newElements, long timestamp, long threadtimestamp) throws IllegalStateException {
    if (oldElements.length == 0 && newElements.length == 0) {
        return;
    }
    
    int newMax = newElements.length - 1;
    int oldMax = oldElements.length - 1;
    int globalMax = Math.max(oldMax, newMax);
    
    List<StackTraceElement> newElementsList = Collections.EMPTY_LIST;
    List<StackTraceElement> oldElementsList = Collections.EMPTY_LIST;
    
    for (int iteratorIndex = 0; iteratorIndex <= globalMax; iteratorIndex++) {
        StackTraceElement oldElement = oldMax >= iteratorIndex ? oldElements[oldMax - iteratorIndex] : null;
        StackTraceElement newElement = newMax >= iteratorIndex ? newElements[newMax - iteratorIndex] : null;
        
        if (oldElement != null && newElement != null) {
            if (!oldElement.equals(newElement)) {
                if (hasSameMethodInfo(oldElement,newElement)) {
                    iteratorIndex++;
                }
                newElementsList = Arrays.asList(newElements).subList(0, newMax - iteratorIndex + 1);
                oldElementsList = Arrays.asList(oldElements).subList(0, oldMax - iteratorIndex + 1);
                break;
            }
        } else if (oldElement == null && newElement != null) {
            newElementsList = Arrays.asList(newElements).subList(0, newMax - iteratorIndex + 1);
            break;
            
        } else if (oldElement != null && newElement == null) {
            oldElementsList = Arrays.asList(oldElements).subList(0, oldMax - iteratorIndex + 1);
            break;
            
        }
    }
    
    // !!! The order is important - first we need to exit from the
    // already entered methods and only then we can enter the new ones !!!
    addMethodExits(threadId, oldElementsList, timestamp, threadtimestamp, newElements.length == 0);
    addMethodEntries(threadId, newElementsList, timestamp, threadtimestamp, oldElements.length == 0);
}
 
源代码20 项目: visualvm   文件: StackTraceSnapshotBuilder.java
private void processDiffs(int threadId, StackTraceElement[] oldElements, StackTraceElement[] newElements, long timestamp, long threadtimestamp) throws IllegalStateException {
    if (oldElements.length == 0 && newElements.length == 0) {
        return;
    }
    
    int newMax = newElements.length - 1;
    int oldMax = oldElements.length - 1;
    int globalMax = Math.max(oldMax, newMax);
    
    List<StackTraceElement> newElementsList = Collections.EMPTY_LIST;
    List<StackTraceElement> oldElementsList = Collections.EMPTY_LIST;
    
    for (int iteratorIndex = 0; iteratorIndex <= globalMax; iteratorIndex++) {
        StackTraceElement oldElement = oldMax >= iteratorIndex ? oldElements[oldMax - iteratorIndex] : null;
        StackTraceElement newElement = newMax >= iteratorIndex ? newElements[newMax - iteratorIndex] : null;
        
        if (oldElement != null && newElement != null) {
            if (!oldElement.equals(newElement)) {
                if (hasSameMethodInfo(oldElement,newElement)) {
                    iteratorIndex++;
                }
                newElementsList = Arrays.asList(newElements).subList(0, newMax - iteratorIndex + 1);
                oldElementsList = Arrays.asList(oldElements).subList(0, oldMax - iteratorIndex + 1);
                break;
            }
        } else if (oldElement == null && newElement != null) {
            newElementsList = Arrays.asList(newElements).subList(0, newMax - iteratorIndex + 1);
            break;
            
        } else if (oldElement != null && newElement == null) {
            oldElementsList = Arrays.asList(oldElements).subList(0, oldMax - iteratorIndex + 1);
            break;
            
        }
    }
    
    // !!! The order is important - first we need to exit from the
    // already entered methods and only then we can enter the new ones !!!
    addMethodExits(threadId, oldElementsList, timestamp, threadtimestamp, newElements.length == 0);
    addMethodEntries(threadId, newElementsList, timestamp, threadtimestamp, oldElements.length == 0);
}