Here you can find the source of getFileList(Map
private static <T> List<String> getFileList(Map<File, Map<T, List<String>>> map, File dir, T key)
//package com.java2s; /**//from www.j ava 2s. c om * Copyright (c) 2013 Puppet Labs, Inc. and other contributors, as listed below. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Puppet Labs */ import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { private static <T> List<String> getFileList(Map<File, Map<T, List<String>>> map, File dir, T key) { Map<T, List<String>> dirMap = map.get(dir); if (dirMap == null) map.put(dir, dirMap = new HashMap<T, List<String>>()); List<String> files = dirMap.get(key); if (files == null) dirMap.put(key, files = new ArrayList<String>()); return files; } }