BasicUtil
Date: 2012-06-29

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.chromium.sdk.util
Class BasicUtil

    java.lang.Object
      org.chromium.sdk.util.BasicUtil

    public class BasicUtil

extends java.lang.Object

Utilities for safe using collections and several small methods missing in standard Java library.

Constructor Summary
`BasicUtil()`

Method Summary
`static
`<K,V> boolean`
` | `containsKeySafe(java.util.Map<K,V> map, K key)` Type-safe wrapper for `Map.containsKey(Object)` method.
`static
`<V> boolean`
` | `containsSafe(java.util.Collection<V> collection, V value)` Type-safe wrapper for `Collection.contains(Object)` method.
`static
`<T> boolean`
` | `eq(T left, T right)` Convenience wrapper around `Object.equals(Object)` method that allows both left and right to be null.
`static
`<K,V> V`
` | `getSafe(java.util.Map<K,V> map, K key)` Type-safe wrapper for `Map.get(Object)` method.
`static java.lang.String` | `getStacktraceString(java.lang.Exception exception)` Takes stacktrace string out of exception.
`static int` | `hashCode(java.lang.Object obj)` Convenience wrapper around `Object.hashCode()` method that allows object to be null.
`static java.lang.String` | `join(java.lang.Iterable<? extends java.lang.String> components, java.lang.String separator)` Implementation of traditional join operation.
`static
`<V> boolean`
` | `removeSafe(java.util.Collection<V> collection, V value)` Type-safe wrapper for `Collection.remove(Object)` method.
`static
`<K,V> V`
` | `removeSafe(java.util.Map<K,V> map, K key)` Type-safe wrapper for `Map.remove(Object)` method.
`static
`<T> T[]`
` | `toArray(java.util.Collection<? extends T> collection, java.lang.Class<T> clazz)` Convenient method wrapping `Collection.toArray()`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BasicUtil

    public BasicUtil()

Method Detail

### toArray

    public static <T> T[] toArray(java.util.Collection<? extends T> collection,
                                  java.lang.Class<T> clazz)

  Convenient method wrapping `Collection.toArray()`. It creates array of proper length of proper type.

### removeSafe

    public static <K,V> V removeSafe(java.util.Map<K,V> map,
                                     K key)

  Type-safe wrapper for `Map.remove(Object)` method. It restricts type of key and makes sure that you do not try to remove key of wrong type.

### getSafe

    public static <K,V> V getSafe(java.util.Map<K,V> map,
                                  K key)

  Type-safe wrapper for `Map.get(Object)` method. It restricts type of key and makes sure that you do not try to get by key of wrong type.

### containsKeySafe

    public static <K,V> boolean containsKeySafe(java.util.Map<K,V> map,
                                                K key)

  Type-safe wrapper for `Map.containsKey(Object)` method. It restricts type of a value and makes sure that you do not call method for the value wrong type.

### containsSafe

    public static <V> boolean containsSafe(java.util.Collection<V> collection,
                                           V value)

  Type-safe wrapper for `Collection.contains(Object)` method. It restricts type of a value and makes sure that you do not call method for the value wrong type.

### removeSafe

    public static <V> boolean removeSafe(java.util.Collection<V> collection,
                                         V value)

  Type-safe wrapper for `Collection.remove(Object)` method. It restricts type of a value and makes sure that you do not call method for the value wrong type.

### eq

    public static <T> boolean eq(T left,
                                 T right)

  Convenience wrapper around `Object.equals(Object)` method that allows both left and right to be null.

### hashCode

    public static int hashCode(java.lang.Object obj)

  Convenience wrapper around `Object.hashCode()` method that allows object to be null.

### join

    public static java.lang.String join(java.lang.Iterable<? extends java.lang.String> components,
                                        java.lang.String separator)

  Implementation of traditional join operation.

### getStacktraceString

    public static java.lang.String getStacktraceString(java.lang.Exception exception)

  Takes stacktrace string out of exception.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD