java.lang.Boolean.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中java.lang.Boolean.<init>()方法的一些代码示例,展示了Boolean.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Boolean.<init>()方法的具体详情如下:
包路径:java.lang.Boolean
类名称:Boolean
方法名:<init>

Boolean.<init>介绍

[英]Constructs a new Boolean with its boolean value specified by string. If string is not null and is equal to "true" using a non-case sensitive comparison, the result will be a Boolean representing the primitive value true, otherwise it will be a Boolean representing the primitive value false.
[中]构造一个新的布尔值,其布尔值由字符串指定。如果字符串不为null,并且使用不区分大小写的比较等于“true”,则结果将是表示基元值true的布尔值,否则将是表示基元值false的布尔值。

代码示例

代码示例来源:origin: Meituan-Dianping/Robust

private static Object fixObj(Object booleanObj) {
    if (booleanObj instanceof Byte) {
      byte byteValue = (Byte) booleanObj;
      boolean booleanValue = byteValue != 0x00;
      return new Boolean(booleanValue);
    }
    return booleanObj;
  }
}

代码示例来源:origin: libgdx/libgdx

private Object toObject (String key, String value) {
  if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value));
  if (key.endsWith("i")) return new Integer(Integer.parseInt(value));
  if (key.endsWith("l")) return new Long(Long.parseLong(value));
  if (key.endsWith("f")) return new Float(Float.parseFloat(value));
  return value;
}

代码示例来源:origin: libgdx/libgdx

private Object toObject (String key, String value) {
  if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value));
  if (key.endsWith("i")) return new Integer(Integer.parseInt(value));
  if (key.endsWith("l")) return new Long(Long.parseLong(value));
  if (key.endsWith("f")) return new Float(Float.parseFloat(value));
  return value;
}

代码示例来源:origin: org.osgi/org.osgi.compendium

/**
 * Returns the hash code for this permission object. If two DmtPermission
 * objects are equal according to the {@link #equals(Object)} method, then
 * calling this method on each of the two DmtPermission objects must produce
 * the same integer result.
 * 
 * @return hash code for this permission object
 */
public int hashCode() {
  return new Integer(mask).hashCode() ^ new Boolean(prefixPath).hashCode() ^ path.hashCode();
}

代码示例来源:origin: stackoverflow.com

> typeof new Boolean(false)
"object"
> typeof new String("foo")
"object"
> typeof new Number(42)
"object"

代码示例来源:origin: redisson/redisson

Object getValue(ClassLoader cl, ClassPool cp, Method m) {
  return new Boolean(getValue());
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new java.lang.Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: checkstyle/checkstyle

/** fully qualified Boolean instantiation in a method. **/
Boolean getBoolean()
{
  return new Boolean(true);
}

代码示例来源:origin: commons-collections/commons-collections

/**
 * Get a boolean associated with the given configuration key.
 *
 * @param key The configuration key.
 * @param defaultValue The default value.
 * @return The associated boolean.
 * @throws ClassCastException is thrown if the key maps to an
 * object that is not a Boolean.
 */
public boolean getBoolean(String key, boolean defaultValue) {
  return getBoolean(key, new Boolean(defaultValue)).booleanValue();
}

代码示例来源:origin: checkstyle/checkstyle

Boolean getBoolean()
{
  return new java.lang.Boolean(true);
}

代码示例来源:origin: google/guava

@Generates
private Boolean generateBooleanObject() {
 return new Boolean(generateBoolean());
}

代码示例来源:origin: commons-collections/commons-collections

public List getComparableObjectsOrdered() {
  List list = new ArrayList();
  list.add(new Boolean(false));
  list.add(Boolean.FALSE);
  list.add(new Boolean(false));
  list.add(Boolean.TRUE);
  list.add(new Boolean(true));
  list.add(Boolean.TRUE);
  return list;
}

代码示例来源:origin: prestodb/presto

@Setup(Iteration)
  public void setup()
  {
    for (int i = 0; i < ARRAY_SIZE; i++) {
      boolean value = ThreadLocalRandom.current().nextBoolean();
      boolean isNull = ThreadLocalRandom.current().nextBoolean();
      primitives[i] = value;
      boxed[i] = value;
      constants[i] = isNull ? null : value;
      objects[i] = isNull ? null : new Boolean(value);
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
@SuppressWarnings( {"BooleanConstructorCall"})
public void testBooleanType() {
  final Boolean original = Boolean.TRUE;
  final Boolean copy = new Boolean( true );
  final Boolean different = Boolean.FALSE;
  runBasicTests( BooleanType.INSTANCE, original, copy, different );
  runBasicTests( NumericBooleanType.INSTANCE, original, copy, different );
  runBasicTests( YesNoType.INSTANCE, original, copy, different );
  runBasicTests( TrueFalseType.INSTANCE, original, copy, different );
}

相关文章