Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { private static final Map<String, String> extensionToMimeTypeMap = new HashMap<String, String>(); /** * Returns true if the given extension has a registered MIME type. * * @param extension * A file extension without the leading '.' * @return True iff there is an extension entry in the map. */ public static boolean hasExtension(String extension) { if (extension == null || extension.isEmpty()) { return false; } return extensionToMimeTypeMap.containsKey(extension); } }