com.google.common.collect.Maps.valueOrNull()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(135)

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

Maps.valueOrNull介绍

暂无

代码示例

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

@Override
public @Nullable V get(@Nullable Object key) {
 return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
}

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

@NullableDecl
@Override
public V get(@NullableDecl Object key) {
 return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
}

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

@Override
public @Nullable Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut)
     || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

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

@Override
@NullableDecl
public Range<C> get(@NullableDecl Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut)
     || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

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

@Override
@NullableDecl
public Range<C> get(@NullableDecl Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut)
     || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: com.diffplug.guava/guava-collect

@Nullable
@Override
public V get(@Nullable Object key) {
  return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@NullableDecl
@Override
public V get(@NullableDecl Object key) {
 return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@Override
public @Nullable V get(@Nullable Object key) {
 return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: com.diffplug.guava/guava-collect

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
  if (key instanceof Cut) {
    try {
      @SuppressWarnings("unchecked") // we catch CCE's
      Cut<C> cut = (Cut<C>) key;
      if (!lowerBoundWindow.contains(cut)
          || cut.compareTo(restriction.lowerBound) < 0
          || cut.compareTo(restriction.upperBound) >= 0) {
        return null;
      } else if (cut.equals(restriction.lowerBound)) {
        // it might be present, truncated on the left
        Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
        if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
          return candidate.intersection(restriction);
        }
      } else {
        Range<C> result = rangesByLowerBound.get(cut);
        if (result != null) {
          return result.intersection(restriction);
        }
      }
    } catch (ClassCastException e) {
      return null;
    }
  }
  return null;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: Nextdoor/bender

@Override
@Nullable
public Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut) || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@Override
public @Nullable Range<C> get(@Nullable Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut)
     || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
@NullableDecl
public Range<C> get(@NullableDecl Object key) {
 if (key instanceof Cut) {
  try {
   @SuppressWarnings("unchecked") // we catch CCE's
   Cut<C> cut = (Cut<C>) key;
   if (!lowerBoundWindow.contains(cut)
     || cut.compareTo(restriction.lowerBound) < 0
     || cut.compareTo(restriction.upperBound) >= 0) {
    return null;
   } else if (cut.equals(restriction.lowerBound)) {
    // it might be present, truncated on the left
    Range<C> candidate = Maps.valueOrNull(rangesByLowerBound.floorEntry(cut));
    if (candidate != null && candidate.upperBound.compareTo(restriction.lowerBound) > 0) {
     return candidate.intersection(restriction);
    }
   } else {
    Range<C> result = rangesByLowerBound.get(cut);
    if (result != null) {
     return result.intersection(restriction);
    }
   }
  } catch (ClassCastException e) {
   return null;
  }
 }
 return null;
}

相关文章