Example usage for com.google.common.collect ImmutableSortedMultiset copyOf

List of usage examples for com.google.common.collect ImmutableSortedMultiset copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSortedMultiset copyOf.

Prototype

public static <E> ImmutableSortedMultiset<E> copyOf(Iterator<? extends E> elements) 

Source Link

Document

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Usage

From source file:org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc.java

@Override
public String getExprString(boolean sortChildren) {
    if (sortChildren) {
        UDFType udfType = genericUDF.getClass().getAnnotation(UDFType.class);
        if (udfType.commutative()) {
            // Get the sorted children expr strings
            String[] childrenExprStrings = new String[chidren.size()];
            for (int i = 0; i < childrenExprStrings.length; i++) {
                childrenExprStrings[i] = chidren.get(i).getExprString();
            }/*from   w w w.  java2  s . co m*/
            return genericUDF.getDisplayString(ImmutableSortedMultiset.copyOf(childrenExprStrings)
                    .toArray(new String[childrenExprStrings.length]));
        }
    }
    return getExprString();
}