edu.utah.further.core.util.collections.AdvancedCollectionUtil.java Source code

Java tutorial

Introduction

Here is the source code for edu.utah.further.core.util.collections.AdvancedCollectionUtil.java

Source

/**
 * Copyright (C) [2013] [The FURTHeR Project]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.utah.further.core.util.collections;

import java.util.Comparator;

import org.apache.commons.collections15.OrderedBidiMap;
import org.apache.commons.collections15.bidimap.DualTreeBidiMap;

import edu.utah.further.core.api.context.Api;
import edu.utah.further.core.api.context.Utility;

/**
 * Utilities related to collections and arrays that use the google and generic collections
 * API.
 * <p>
 * ---------------------------------------------------------------------------- -------<br>
 * (c) 2008-2013 FURTHeR Project, AVP Health Sciences IT Office, University of Utah<br>
 * Contact: {@code <further@utah.edu>}<br>
 * Biomedical Informatics, 26 South 2000 East<br>
 * Room 5775 HSEB, Salt Lake City, UT 84112<br>
 * Day Phone: 1-801-581-4080<br>
 * ---------------------------------------------------------------------------- -------
 * 
 * @author Oren E. Livne {@code <oren.livne@utah.edu>}
 * @version Oct 13, 2008
 */
@Utility
@Api
public abstract class AdvancedCollectionUtil {
    // ========================= CONSTANTS =================================

    // ========================= NESTED TYPES ==============================

    // ========================= METHODS ===================================

    /**
     * A factory method of a sorted bi-directional map using the default implementation
     * (dual bi-di tree map).
     * 
     * @param <K>
     *            key type
     * @param <V>
     *            value type
     * @param comparator
     *            key comparator
     * @param inverseComparator
     *            value comparator
     * @return an empty ordered bi-di map
     */
    public static <K, V> OrderedBidiMap<K, V> newOrderedBidiMap(final Comparator<? super K> comparator,
            final Comparator<? super V> inverseComparator) {
        return new DualTreeBidiMap<>(comparator, inverseComparator);
    }
}