Java Code Examples for org.apache.commons.lang3.StringUtils.equalsAny()

The following are Jave code examples for showing how to use equalsAny() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: cyberduck   File: MantaAccountHomeInfo.java   View Source Code Vote up 6 votes
private Path buildNormalizedHomePath(final String rawHomePath) {
    final String defaultPath = StringUtils.defaultIfBlank(rawHomePath, Path.HOME);
    final String accountRootRegex = String.format("^/?(%s|~~?)/?", accountRoot.getAbsolute());
    final String subdirectoryRawPath = defaultPath.replaceFirst(accountRootRegex, "");

    if(StringUtils.isEmpty(subdirectoryRawPath)) {
        return accountRoot;
    }

    final String[] subdirectoryPathSegments = StringUtils.split(subdirectoryRawPath, Path.DELIMITER);
    Path homePath = accountRoot;

    for(final String pathSegment : subdirectoryPathSegments) {
        EnumSet<Path.Type> types = EnumSet.of(Path.Type.directory);
        if(homePath.getParent().equals(accountRoot)
            && StringUtils.equalsAny(pathSegment, HOME_PATH_PRIVATE, HOME_PATH_PUBLIC)) {
            types.add(Path.Type.volume);
        }

        homePath = new Path(homePath, pathSegment, types);
    }

    return homePath;
}
 
Example 2
Project: mylion-mvn   File: ArrayMap.java   View Source Code Vote up 5 votes
public void putItem(String k , V v){
	
	List<V> values = StringUtils.equalsAny("", 
			StringTools.toString( get(k)) ) ? null : get( k );
	if(null == values){
		values = new Vector<>();
		super.put(k, values) ;
	}
	values.add(v) ;
}
 
Example 3
Project: mylion-mvn   File: ArrayMap.java   View Source Code Vote up 5 votes
public void putItem(String k , V v){
	
	List<V> values = StringUtils.equalsAny("", 
			StringTools.toString( get(k)) ) ? null : get( k );
	if(null == values){
		values = new Vector<>();
		super.put(k, values) ;
	}
	values.add(v) ;
}
 
Example 4
Project: sponge   File: DefaultInteractiveMode.java   View Source Code Vote up 4 votes
protected boolean iteration(InteractiveModeConsole reader, ScriptKnowledgeBaseInterpreter scriptInterpreter) throws IOException {
    StringBuffer commandBuffer = new StringBuffer();
    while (true) {
        if (!engine.isRunning()) {
            return false;
        }

        String command = null;
        try {
            command = reader.readLine();
        } catch (IOException e) {
            handleException("readLine", e);
            return false;
        }

        if (command == null) {
            return false;
        }

        command = StringUtils.stripEnd(command, null);

        if (StringUtils.equalsAny(command.trim(), InteractiveModeConstants.EXIT_COMMAND, InteractiveModeConstants.QUIT_COMMAND)) {
            return false;
        }

        boolean isMultiLineStatement = command.endsWith(InteractiveModeConstants.LINE_BREAK);
        if (isMultiLineStatement) {
            command = StringUtils.removeEnd(command, InteractiveModeConstants.LINE_BREAK);
        }

        commandBuffer.append(command);

        if (isMultiLineStatement) {
            commandBuffer.append(System.lineSeparator());
        } else {
            break;
        }
    }

    if (engine.isRunning()) {
        scriptInterpreter.eval(commandBuffer.toString());
        return true;
    } else {
        return false;
    }
}