本文整理了Java中javaslang.collection.List.length()
方法的一些代码示例,展示了List.length()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.length()
方法的具体详情如下:
包路径:javaslang.collection.List
类名称:List
方法名:length
暂无
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.validation.main
private Validation<List<SMFParseError>, SMFSchemaIdentifier>
parseStatementIdentifier(
final List<String> text)
{
if (text.length() == 4) {
try {
final SMFSchemaName schema = SMFSchemaName.of(text.get(1));
final int major = Integer.parseUnsignedInt(text.get(2));
final int minor = Integer.parseUnsignedInt(text.get(3));
return valid(SMFSchemaIdentifier.of(schema, major, minor));
} catch (final NumberFormatException e) {
return invalid(List.of(SMFParseError.of(
this.reader.position(), e.getMessage(), Optional.of(e))));
}
}
final StringBuilder sb = new StringBuilder(128);
sb.append("Incorrect number of arguments.");
sb.append(System.lineSeparator());
sb.append(
" Expected: schema <schema> <version-major> <version-minor>");
sb.append(System.lineSeparator());
sb.append(" Received: ");
sb.append(text.toJavaStream().collect(Collectors.joining(" ")));
sb.append(System.lineSeparator());
return invalid(List.of(SMFParseError.of(
this.reader.position(),
sb.toString(),
Optional.empty())));
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
NullCheck.notNull(text, "text");
if (text.length() > 0 && text.length() <= 3) {
try {
final Optional<SMFSchemaName> schema_name;
schema_name = Optional.of(SMFSchemaName.of(text.get(0)));
if (text.length() == 2) {
schema_version = Optional.empty();
if (text.length() == 3) {
final int major = Integer.parseUnsignedInt(text.get(1));
final int minor = Integer.parseUnsignedInt(text.get(2));
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.validation.main
final List<String> line)
if (line.length() == 6) {
final String text_req = line.get(1);
final String text_name = line.get(2);
代码示例来源:origin: com.io7m.smfj/io7m-smfj-format-text
private void parseMeta(
final List<String> line)
throws Exception
{
if (line.length() == 4) {
final long vendor_id =
(long) Integer.parseUnsignedInt(line.get(1), 16);
final long schema_id =
(long) Integer.parseUnsignedInt(line.get(2), 16);
final long lines =
Long.parseUnsignedLong(line.get(3));
this.parseMetaDataValues(vendor_id, schema_id, lines);
} else {
super.failExpectedGot(
"Incorrect number of arguments",
"meta <vendor-id> <schema-id> <integer-unsigned>",
line.toJavaStream().collect(Collectors.joining(" ")));
}
}
代码示例来源:origin: com.io7m.smfj/io7m-smfj-format-text
if (line.length() == 3) {
try {
final long v0 = Long.parseUnsignedLong(line.get(0));
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
NullCheck.notNull(text, "text");
if (text.length() == 4) {
try {
final SMFAttributeName attr = SMFAttributeName.of(text.get(0));
代码示例来源:origin: com.io7m.smfj/io7m-smfj-format-text
if (line.length() != 3) {
return invalid(List.of(this.makeErrorExpectedGot(
"Incorrect number of arguments.",
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
NullCheck.notNull(text, "text");
if (text.length() == 2) {
try {
final int size;
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() == 1) {
try {
return valid(create(Paths.get(text.get(0))));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() >= 1) {
try {
return valid(create(text.map(SMFAttributeName::of).toSet()));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() == 1) {
try {
final SMFAttributeName attr = SMFAttributeName.of(text.get(0));
return Validation.valid(create(attr));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() == 2) {
try {
final SMFAttributeName name = SMFAttributeName.of(text.get(0));
final int size = Integer.parseUnsignedInt(text.get(1));
return valid(create(name, size));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() == 4) {
try {
final SMFSchemaName name = SMFSchemaName.of(text.get(0));
final int major = Integer.parseUnsignedInt(text.get(1));
final int minor = Integer.parseUnsignedInt(text.get(2));
final Path path = Paths.get(text.get(3));
return valid(create(SMFSchemaIdentifier.of(name, major, minor), path));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
/**
* Attempt to parse a command.
*
* @param file The file, if any
* @param line The line
* @param text The text
*
* @return A parsed command or a list of parse errors
*/
public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse(
final Optional<URI> file,
final int line,
final List<String> text)
{
NullCheck.notNull(file, "file");
NullCheck.notNull(text, "text");
if (text.length() == 2) {
try {
final SMFAttributeName source = SMFAttributeName.of(text.get(0));
final SMFAttributeName target = SMFAttributeName.of(text.get(1));
return Validation.valid(
create(source, target));
} catch (final IllegalArgumentException e) {
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
}
return errorExpectedGotValidation(file, line, makeSyntax(), text);
}
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
NullCheck.notNull(text, "text");
if (text.length() == 3) {
try {
final SMFSchemaName schema = SMFSchemaName.of(text.get(0));
代码示例来源:origin: com.io7m.smfj/com.io7m.smfj.processing.main
NullCheck.notNull(text, "text");
if (text.length() == 3) {
try {
final SMFSchemaName schema = SMFSchemaName.of(text.get(0));
内容来源于网络,如有侵权,请联系作者删除!