Here you can find the source of getFileFilter( String text, String... formats)
private static javax.swing.filechooser.FileFilter getFileFilter( String text, String... formats)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { private static Map<String, javax.swing.filechooser.FileFilter> fmt2FileFilter = null; private static javax.swing.filechooser.FileFilter getFileFilter( String text, String... formats) { javax.swing.filechooser.FileFilter rv = null; if (formats != null) { if (formats.length > 0) { if (fmt2FileFilter == null) { fmt2FileFilter = new Hashtable<String, javax.swing.filechooser.FileFilter>(); }//from www. j a va 2 s . c om rv = fmt2FileFilter.get(formats[0]); if (rv == null) { rv = new javax.swing.filechooser.FileNameExtensionFilter( text, formats); fmt2FileFilter.put(formats[0], rv); } } } return rv; } }