Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Indicates if the collection has been wrapped by Collections.unmodifiableCollection(...)
     * 
     * @param collection
     * @return
     */
    public static boolean isUnmodifiableCollection(Object collection) {
        // Precondition checking
        //
        if (collection == null) {
            return false;
        }

        // Get class
        //
        Class<?> collectionClass = collection.getClass();
        return (collectionClass.getName().startsWith("java.util.Collections$Unmodifiable"));
    }
}