@@ -0,0 +1,2371 @@
+/*%0A * Copyright (C) 2016 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.google.android.cameraview;%0A%0Aimport android.support.v4.util.ArrayMap;%0A%0Aimport java.util.Set;%0Aimport java.util.SortedSet;%0Aimport java.util.TreeSet;%0A%0A/**%0A * A collection class that automatically groups %7B@link Size%7Ds by their %7B@link AspectRatio%7Ds.%0A */%0Aclass SizeMap %7B%0A%0A    private final ArrayMap%3CAspectRatio, SortedSet%3CSize%3E%3E mRatios = new ArrayMap%3C%3E();%0A%0A    /**%0A     * Add a new %7B@link Size%7D to this collection.%0A     *%0A     * @param size The size to add.%0A     * @return %7B@code true%7D if it is added, %7B@code false%7D if it already exists and is not added.%0A     */%0A    public boolean add(Size size) %7B%0A        for (AspectRatio ratio : mRatios.keySet()) %7B%0A            if (ratio.matches(size)) %7B%0A                final SortedSet%3CSize%3E sizes = mRatios.get(ratio);%0A                if (sizes.contains(size)) %7B%0A                    return false;%0A                %7D else %7B%0A                    sizes.add(size);%0A                    return true;%0A                %7D%0A            %7D%0A        %7D%0A        // None of the existing ratio matches the provided size; add a new key%0A        SortedSet%3CSize%3E sizes = new TreeSet%3C%3E();%0A        sizes.add(size);%0A        mRatios.put(AspectRatio.of(size.getWidth(), size.getHeight()), sizes);%0A        return true;%0A    %7D%0A%0A    /**%0A     * Removes the specified aspect ratio and all sizes associated with it.%0A     *%0A     * @param ratio The aspect ratio to be removed.%0A     */%0A    public void remove(AspectRatio ratio) %7B%0A        mRatios.remove(ratio);%0A    %7D%0A%0A    Set%3CAspectRatio%3E ratios() %7B%0A        return mRatios.keySet();%0A    %7D%0A%0A    SortedSet%3CSize%3E sizes(AspectRatio ratio) %7B%0A        return mRatios.get(ratio);%0A    %7D%0A%0A    void clear() %7B%0A        mRatios.clear();%0A    %7D%0A%0A    boolean isEmpty() %7B%0A        return mRatios.isEmpty();%0A    %7D%0A%0A%7D%0A

Create SizeMap.java