Java Set to ArrayList cast(Set set)

Here you can find the source of cast(Set set)

Description

cast

License

MIT License

Declaration

public static <T> Set<T> cast(Set<?> set) 

Method Source Code

//package com.java2s;
/*!//  w w  w.j a va 2s.  c o m
 * mifmi-commons4j
 * https://github.com/mifmi/mifmi-commons4j
 *
 * Copyright (c) 2015 mifmi.org and other contributors
 * Released under the MIT license
 * https://opensource.org/licenses/MIT
 */

import java.util.List;

import java.util.Set;

public class Main {
    public static <T> List<T> cast(List<?> list) {
        @SuppressWarnings("unchecked")
        List<T> castList = (List<T>) list;
        return castList;
    }

    public static <T> Set<T> cast(Set<?> set) {
        @SuppressWarnings("unchecked")
        Set<T> castSet = (Set<T>) set;
        return castSet;
    }
}

Related

  1. cast(Set p)
  2. cast(Set set)
  3. setToArrayList(Set set)
  4. setToArrayList(Set set)