Java Collection Element Get getCollectionClass(TT tt)

Here you can find the source of getCollectionClass(TT tt)

Description

This function helps avoid compile warnings by just having the warning here.

License

Open Source License

Parameter

Parameter Description
tt a parameter

Return

Collection.class cast as having a type parameter

Declaration

public static <TT> Class<Collection<TT>> getCollectionClass(TT tt) 

Method Source Code

//package com.java2s;

import java.util.Collection;

public class Main {
    /**/*from w ww. j  a  v a2  s . com*/
     * This function helps avoid compile warnings by just having the warning here.
     * @param tt
     * @return Collection.class cast as having a type parameter
     */
    public static <TT> Class<Collection<TT>> getCollectionClass(TT tt) {
        return (Class<Collection<TT>>) Collection.class.asSubclass(Collection.class);
        //    Collection<TT> coll = new ArrayList< TT >();
        //    Class< Collection<TT> > ccls = (Class< Collection<TT> >)coll.getClass();
        //    return ccls;
    }

    /**
     * This function helps avoid compile warnings by just having the warning here.
     * @param ttcls
     * @return Collection.class cast as having a type parameter
     */
    public static <TT> Class<Collection<TT>> getCollectionClass(Class<TT> ttcls) {
        return (Class<Collection<TT>>) Collection.class.asSubclass(Collection.class);
        //    Collection<TT> coll = new ArrayList< TT >();
        //    //Class< Collection<TT> > ccls = (Class< Collection<TT> >)coll.getClass();
        //    Class< Collection<TT> > ccls = (Class< Collection<TT> >)coll.getClass().asSubclass( Collection.class );
        //    return ccls;
    }
}

Related

  1. getClosest(final String pattern, Collection targets)
  2. getCollection(final Iterable iterable)
  3. getCollection(final String iText, final int iStartPosition, final Collection iCollection)
  4. getCollection(Object entity)
  5. getCollection(T... items)
  6. getCollectionClosingSymbol(Collection col)
  7. getCollectionPreview(final Collection collection, int previewSize)
  8. getCollectionSize(Collection collection)
  9. getCollectionSize(Collection collection)