/*
 * Copyright (C) 2013 nohana, Inc. All rights reserved.
 *
 * 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 com.amalgam.collection;

import java.util.Collection;

public final class CollectionUtils {
    private CollectionUtils() { }

    /**
     * Builds a string for a collection of objects.
     * Each element of the collection if stringified according to {@link String#valueOf(Object)}
     * rules.
     * @param collection the collection to stringify. can be null
     * @return a string representing the collection
     * @see String#valueOf(Object)
     */
    public static String toString(final Collection<?> collection) {
        if (collection == null) return String.valueOf(collection);
        //else
        final StringBuilder result = new StringBuilder().append("{");
        String elementSeparator = "";
        for (final Object element : collection) {
            result.append(elementSeparator);
            result.append(String.valueOf(element));
            elementSeparator = ",";
        }
        result.append("}");
        return result.toString();
    }
}
@@ -1599,9 +1599,310 @@
 ;%0A    %7D%0A
-%7D
+%0A    /**%0A     * Calculates the index of the last entry in the collection.%0A     * @return the last entry index.%0A     */%0A    public static int getLastIndex(final Collection%3C?%3E collection) %7B%0A        if (isEmptry(collection)) %7B%0A            return 0;%0A        %7D%0A        return collection.size() - 1;%0A    %7D%0A%7D%0A

Add last index calculator