MCPcopy Create free account
hub / github.com/antlr/codebuff / weigher

Method weigher

corpus/java/training/guava/cache/CacheBuilder.java:487–503  ·  view source on GitHub ↗

Specifies the weigher to use in determining the weight of entries. Entry weight is taken into consideration by #maximumWeight(long) when determining which entries to evict, and use of this method requires a corresponding call to #maximumWeight(long) prior to calling #build. W

(
      Weigher<? super K1, ? super V1> weigher)

Source from the content-addressed store, hash-verified

485 * @since 11.0
486 */
487 @GwtIncompatible // To be supported
488 public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> weigher(
489 Weigher<? super K1, ? super V1> weigher) {
490 checkState(this.weigher == null);
491 if (strictParsing) {
492 checkState(
493 this.maximumSize == UNSET_INT,
494 "weigher can not be combined with maximum size",
495 this.maximumSize);
496 }
497
498 // safely limiting the kinds of caches this can produce
499 @SuppressWarnings("unchecked")
500 CacheBuilder<K1, V1> me = (CacheBuilder<K1, V1>) this;
501 me.weigher = checkNotNull(weigher);
502 return me;
503 }
504
505 long getMaximumWeight() {
506 if (expireAfterWriteNanos == 0 || expireAfterAccessNanos == 0) {

Callers 1

recreateCacheBuilderMethod · 0.45

Calls 2

checkStateMethod · 0.45
checkNotNullMethod · 0.45

Tested by

no test coverage detected