Home

Awesome

guava-postfix-plugin

Guava postfix plugin for IntelliJ

Available templates:

Preconditions

Postfix ExpressionDescriptionExample
.checkArgumentChecks that the boolean is truecheckArgument(expr)
.checkNotNullChecks that the value is not nullcheckNotNull(expr)
.checkStateChecks some state of the object, not dependent on the method argumentscheckState(expr)
.checkElementIndexChecks that index is a valid element index into a list, string, or array with the specified sizecheckElementIndex(index, size)
.checkPositionIndexChecks that index is a valid position index into a list, string, or array with the specified sizecheckPositionIndex(index, size)
.checkPositionIndexesChecks that [start, end) is a valid sub range of a list, string, or array with the specified sizecheckPositionIndexes(start, end, size)

Base Utilities

Postfix ExpressionDescriptionExample
.joinJoins pieces of text (specified as an array, Iterable, varargs or even a Map) with a separatorJoiner.on(',').join(iterable)
.splitExtracts non-overlapping substrings from an input string, typically by recognizing appearances of a separator sequenceSplitter.on(',').split(charsequence)

Immutable Collections

Postfix ExpressionDescriptionExample
.immutableListCopyOfCreates an immutable list containing the given elements, in orderImmutableList.copyOf(Iterable)
.immutableListOfCreates an immutable list containing a single elementImmutableList.of(Iterable)
.immutableSetCopyOfCreates an immutable set containing the given elements, in orderImmutableSet.copyOf(Iterable)
.immutableSetOfCreates an immutable set containing a single elementImmutableSet.of(Object)

Iterable Collections

Postfix ExpressionDescriptionExample
.fluentIterableCreates a fluent iterable that wraps iterable, or iterable itself if it is already a FluentIterableFluentIterable.from(Iterable)