# Class CodeUtil

java.lang.Object
htsjdk.samtools.util.CodeUtil

public class CodeUtil extends Object
Miscellaneous util methods that don't fit anywhere else.

## Constructor Summary

Constructors
Constructor
Description
`CodeUtil()`

## Method Summary

Modifier and Type
Method
Description
`static <T> void`
`applyIfNotNull(T input, Consumer<T> action)`
Applied the Consumer on the input if the input is not null, serves as a way to avoid writing: `if(input != null){ action.apply(input); }` and replacing it with `applyIfNotNull(input,action);`
`static <T> T`
`getOrElse(T value1, T value2)`
Mimic of Oracle's nvl() - returns the first value if not null, otherwise the second value.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CodeUtil

public CodeUtil()

## Method Details

### getOrElse

public static <T> T getOrElse(T value1, T value2)
Mimic of Oracle's nvl() - returns the first value if not null, otherwise the second value.

### applyIfNotNull

public static <T> void applyIfNotNull(T input, Consumer<T> action)
Applied the Consumer on the input if the input is not null, serves as a way to avoid writing: `if(input != null){ action.apply(input); }` and replacing it with `applyIfNotNull(input,action);`

Type Parameters:
  `T` - the type of the input.
Parameters:
  `input` - a nullable object
  `action` - a Consumer that will be applied to the input if it isn't null.