本文整理了Java中com.google.common.primitives.Bytes.lastIndexOf()
方法的一些代码示例,展示了Bytes.lastIndexOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.lastIndexOf()
方法的具体详情如下:
包路径:com.google.common.primitives.Bytes
类名称:Bytes
方法名:lastIndexOf
[英]Returns the index of the last appearance of the value target in array.
[中]返回数组中值目标最后一次出现的索引。
代码示例来源:origin: google/guava
/**
* Returns the index of the last appearance of the value {@code target} in {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
* such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: google/j2objc
/**
* Returns the index of the last appearance of the value {@code target} in {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
* such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns the index of the last appearance of the value {@code target} in {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
* such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: google/guava
public void testLastIndexOf() {
assertEquals(-1, Bytes.lastIndexOf(EMPTY, (byte) 1));
assertEquals(-1, Bytes.lastIndexOf(ARRAY1, (byte) 2));
assertEquals(-1, Bytes.lastIndexOf(ARRAY234, (byte) 1));
assertEquals(0, Bytes.lastIndexOf(new byte[] {(byte) -1}, (byte) -1));
assertEquals(0, Bytes.lastIndexOf(ARRAY234, (byte) 2));
assertEquals(1, Bytes.lastIndexOf(ARRAY234, (byte) 3));
assertEquals(2, Bytes.lastIndexOf(ARRAY234, (byte) 4));
assertEquals(
3, Bytes.lastIndexOf(new byte[] {(byte) 2, (byte) 3, (byte) 2, (byte) 3}, (byte) 3));
}
代码示例来源:origin: com.google.guava/guava-jdk5
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: com.diffplug.guava/guava-core
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
/**
* Returns the index of the last appearance of the value {@code target} in {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
* such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: com.google.guava/guava-primitives
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: Nextdoor/bender
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.sonatype.sisu/sisu-guava
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: com.atlassian.bundles/guava
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.hudsonci.lib.guava/guava
/**
* Returns the index of the last appearance of the value {@code target} in
* {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target},
* or {@code -1} if no such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Returns the index of the last appearance of the value {@code target} in {@code array}.
*
* @param array an array of {@code byte} values, possibly empty
* @param target a primitive {@code byte} value
* @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
* such index exists.
*/
public static int lastIndexOf(byte[] array, byte target) {
return lastIndexOf(array, target, 0, array.length);
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib
/**
* {@inheritDoc}
*
* @throws NullPointerException
* if the wrapped array was <code>null</code>.
*/
@Override
public int lastIndexOf(Object o) {
// Will make the method fail if array is null.
if (size() < 1) {
return -1;
}
if (o instanceof Byte) {
return Bytes.lastIndexOf(array, ((Byte) o).byteValue());
}
return -1;
}
代码示例来源:origin: com.google.guava/guava-tests
public void testLastIndexOf() {
assertEquals(-1, Bytes.lastIndexOf(EMPTY, (byte) 1));
assertEquals(-1, Bytes.lastIndexOf(ARRAY1, (byte) 2));
assertEquals(-1, Bytes.lastIndexOf(ARRAY234, (byte) 1));
assertEquals(0, Bytes.lastIndexOf(
new byte[] {(byte) -1}, (byte) -1));
assertEquals(0, Bytes.lastIndexOf(ARRAY234, (byte) 2));
assertEquals(1, Bytes.lastIndexOf(ARRAY234, (byte) 3));
assertEquals(2, Bytes.lastIndexOf(ARRAY234, (byte) 4));
assertEquals(3, Bytes.lastIndexOf(
new byte[] { (byte) 2, (byte) 3, (byte) 2, (byte) 3 },
(byte) 3));
}
代码示例来源:origin: org.apache.rya/rya.api
final byte[] row = tripleRow.getRow();
final int firstIndex = Bytes.indexOf(row, DELIM_BYTE);
final int secondIndex = Bytes.lastIndexOf(row, DELIM_BYTE);
final int typeIndex = Bytes.indexOf(row, TYPE_DELIM_BYTE);
final byte[] first = Arrays.copyOf(row, firstIndex);
内容来源于网络,如有侵权,请联系作者删除!