public abstract class

MultiValueSet<C>

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.impl.MultiValueSet<C>

Subclasses:

CameraEventCallbacks

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-core', version: '1.5.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-core
  • version: 1.5.0-alpha01

Artifact androidx.camera:camera-core:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

A value set implementation that store multiple values in type C.

Summary

Constructors
publicMultiValueSet()

Methods
public voidaddAll(java.util.List<java.lang.Object> value)

Adds all of the elements in the specified collection to this value set if they're not already present (optional operation).

public abstract MultiValueSet<java.lang.Object>clone()

Need to implement the clone method for object copy.

public java.util.List<java.lang.Object>getAllItems()

Returns the list of C which containing all the elements were added to this value set.

from java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public MultiValueSet()

Methods

public void addAll(java.util.List<java.lang.Object> value)

Adds all of the elements in the specified collection to this value set if they're not already present (optional operation).

Parameters:

value: collection containing elements to be added to this value.

public java.util.List<java.lang.Object> getAllItems()

Returns the list of C which containing all the elements were added to this value set.

public abstract MultiValueSet<java.lang.Object> clone()

Need to implement the clone method for object copy.

Returns:

the cloned instance.

Source

/*
 * Copyright 2019 The Android Open Source 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 androidx.camera.core.impl;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * A value set implementation that store multiple values in type C.
 *
 * @param <C> The type of the parameter.
 */
public abstract class MultiValueSet<C> {

    private Set<C> mSet = new HashSet<>();

    /**
     * Adds all of the elements in the specified collection to this value set if they're not already
     * present (optional operation).
     *
     * @param  value collection containing elements to be added to this value.
     */
    public void addAll(@NonNull List<C> value) {
        mSet.addAll(value);
    }

    /**
     * Returns the list of {@link C} which containing all the elements were added to this value set.
     */
    @NonNull
    public List<C> getAllItems() {
        return Collections.unmodifiableList(new ArrayList<>(mSet));
    }

    /**
     * Need to implement the clone method for object copy.
     * @return the cloned instance.
     */
    @Override
    public abstract @NonNull MultiValueSet<C> clone();
}