tc.oc.commons.core.util
Code IndexAdd Codota to your IDE (free)

Best code snippets using tc.oc.commons.core.util(Showing top 15 results out of 315)

origin: OvercastNetwork/ProjectAres

  /**
   * Return a generated implementation of {@link T} that delegates all method calls
   * to the instance returned by the given {@link Provider}. That instance is not
   * retrieved until the first time a method is called, after which the returned
   * instance is cached and reused forever.
   *
   * The provider's {@link ClassLoader} is used to load the generated class.
   */
  public static <T> T newCachingProviderProxy(Class<T> type, Provider<T> provider) {
    return newProxy(type, MethodHandleInvoker.caching(provider));
  }
}
origin: OvercastNetwork/ProjectAres

  private void handleCompletion() {
    for(ThrowingRunnable<?> handler : completionHandlers) {
      try {
        handler.runThrows();
      } catch(Throwable e) {
        handleFailure(e);
      }
    }
  }
}
origin: OvercastNetwork/ProjectAres

public <U, E extends Throwable> U let(T value, ThrowingSupplier<U, E> block) throws E {
  if(value == get()) {
    return block.getThrows();
  } else {
    try(CheckedCloseable x = let(value)) {
      return block.getThrows();
    }
  }
}
origin: OvercastNetwork/ProjectAres

/**
 * Add or use an object to this usage collection.
 * @param object the object to add or use.
 */
public void use(E object) {
  if(!containsKey(object)) {
    put(object, new Index());
  } else {
    get(object).change(+1);
  }
}
origin: OvercastNetwork/ProjectAres

  @Override public Uniformity<T> combine(Uniformity<T> that) {
    if(that instanceof Intermediate) {
      return add(((Intermediate<T>) that).value);
    } else {
      return that.combine(this);
    }
  }
}
origin: OvercastNetwork/ProjectAres

public static <E extends Throwable> void propagate(Class<E> ex, ThrowingRunnable<Throwable> block) throws E {
  propagate(ex, () -> {
    block.runThrows();
    return null;
  });
}
origin: OvercastNetwork/ProjectAres

/**
 * Allocate an additional usage space for an object.
 * @param object the object to allocate an additional space for.
 */
public void allocate(E object) {
  if(containsValue(object)) {
    get(object).change(-1);
  }
}
origin: OvercastNetwork/ProjectAres

@Override
default Object[] toArray() {
  final E value = orElse(null);
  return value == null ? ArrayUtils.zeroObjects()
             : new Object[] {value};
}
origin: OvercastNetwork/ProjectAres

/**
 * Return a formatted stack trace
 */
@Override
public String toString() {
  return ExceptionUtils.formatStackTrace(trace(), skipTest());
}
origin: OvercastNetwork/ProjectAres

public static <K, V> void forEachWithIndex(Multimap<K, V> multimap, int start, IndexedBiConsumer<? super K, ? super V> consumer) {
  final Counter index = new Counter(start);
  forEach(multimap, (k, v) -> consumer.accept(k, v, index.next()));
}
origin: OvercastNetwork/ProjectAres

  public CheckedCloseable let(T value) {
    final T old = get();
    set(value);
    return () -> set(old);
  }
}
origin: OvercastNetwork/ProjectAres

public static <T> T propagate(ThrowingSupplier<T, Throwable> block) {
  try {
    return block.getThrows();
  } catch(Throwable e) {
    throw propagate(e);
  }
}
origin: OvercastNetwork/ProjectAres

/**
 * Return a generated implementation of {@link T} that delegates all method calls
 * to the instance returned by the given {@link Provider}. The provider is called
 * for every method invocation.
 *
 * The provider's {@link ClassLoader} is used to load the generated class.
 */
public static <T> T newProviderProxy(Class<T> type, Provider<T> provider) {
  return newProxy(type, MethodHandleInvoker.dynamic(provider));
}
origin: OvercastNetwork/ProjectAres

public static void propagate(ThrowingRunnable<Throwable> block) {
  propagate(() -> {
    block.runThrows();
    return null;
  });
}
origin: OvercastNetwork/ProjectAres

public <E extends Throwable> void let(T value, ThrowingRunnable<E> block) throws E {
  if(value == get()) {
    block.runThrows();
  } else {
    try(CheckedCloseable x = let(value)) {
      block.runThrows();
    }
  }
}
tc.oc.commons.core.util

Most used classes

  • CacheUtils
  • TimeUtils
  • Utils
  • Comparables
  • ExceptionUtils
  • MapUtils,
  • Nullables,
  • Numbers,
  • Pair,
  • Predicates,
  • ProxyUtils,
  • Streams,
  • ArrayUtils,
  • Optionals,
  • Threadable,
  • ThrowingConsumer,
  • TypeMap,
  • AmbiguousElementException,
  • C3

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)