List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:Main.java
/** * Creates an unmodifiable shallow copy of the given original {@link Map}. <p> While the copy returns an immutable * copy of the {@link Map} the content is not cloned in any way. Unless the content is immutable by itself the * result is not fully immutable. In the shallow copy all references are the same as in the original {@link Map}! * </p>/*from www .ja v a 2 s . co m*/ * * @param original The {@link Map} to copy the elements fro. * @param <K> The type of the key * @param <V> The type of the value * * @return Returns an immutable (unmodifiable) copy of the original {@link Map} with all the elements added but not * cloned! */ public static <K, V> Map<K, V> createUnmodifiableShallowCopy(final Map<K, V> original) { if (original == null || original.isEmpty()) { return Collections.emptyMap(); } else { return Collections.unmodifiableMap(new HashMap<K, V>(original)); } }
From source file:com.qwazr.cluster.service.ClusterServiceStatusJson.java
public ClusterServiceStatusJson() { this(StringUtils.EMPTY, ArrayUtils.EMPTY_STRING_ARRAY, Collections.emptyMap()); }
From source file:edu.jhuapl.graphs.jfreechart.PieEffectsTest.java
public static JFreeChartGraphSource getSource() throws GraphException { Map<String, Object> emptyMap = Collections.emptyMap(); List<PointInterface> ps1 = new LinkedList<PointInterface>(); Map<String, Object> params = new HashMap<String, Object>(1); params.put(GraphSource.ITEM_COLOR, Color.red); ps1.add(new DataPoint(3, "Red", params)); params = new HashMap<String, Object>(1); params.put(GraphSource.ITEM_COLOR, Color.green); ps1.add(new DataPoint(5, "Green", params)); params = new HashMap<String, Object>(1); params.put(GraphSource.ITEM_COLOR, Color.blue); ps1.add(new DataPoint(7, "Blue", params)); DataSeries s1 = new DataSeries(ps1, emptyMap); Map<String, Object> graphParams = new HashMap<String, Object>(); graphParams.put(GraphSource.GRAPH_TYPE, GraphSource.GRAPH_TYPE_PIE); graphParams.put(GraphSource.GRAPH_LEGEND, true); JFreeChartGraphSource source = new JFreeChartGraphSource(); source.setData(Arrays.asList(s1)); source.setParams(graphParams);/*from ww w.j ava 2 s . co m*/ source.initialize(); return source; }
From source file:com.inspiresoftware.lib.dto.geda.interceptor.impl.TransferableUtils.java
/** * Work out configurations from {@link com.inspiresoftware.lib.dto.geda.annotations.Transferable} * * @param method method examined./* w w w .j a v a2 s .c o m*/ * @param targetClass class upon which this method was invoked * @return configuration. */ public static Map<Occurrence, AdviceConfig> resolveConfiguration(final Method method, final Class<?> targetClass) { if (GeDAInfrastructure.class.isAssignableFrom(targetClass) || Adapter.class.isAssignableFrom(targetClass)) { return Collections.emptyMap(); } return resolveConfiguration(method, targetClass, true); }
From source file:org.apache.droids.protocol.http.NoAuthHandler.java
@Override public Map<String, Header> getChallenges(HttpResponse response, HttpContext context) throws MalformedChallengeException { return Collections.emptyMap(); }
From source file:Main.java
/** * This method returns a new HashMap which is the intersection of the two Map parameters, based on {@link Object#equals(Object) equality} * of their entries.//ww w . ja v a2s .co m * Any references in the resultant map will be to elements within map1. * * @return a new HashMap whose values represent the intersection of the two Maps. */ public static <K, V> Map<K, V> intersect(Map<K, V> map1, Map<K, V> map2) { if (map1 == null || map1.isEmpty() || map2 == null || map2.isEmpty()) { return Collections.emptyMap(); } // We now know neither map is null. Map<K, V> result = new HashMap<K, V>(); for (Map.Entry<K, V> item : map1.entrySet()) { V value = map2.get(item.getKey()); if (value != null && value.equals(item.getValue())) { result.put(item.getKey(), item.getValue()); } } return result; }
From source file:pl.edu.agh.samm.db.impl.AbstractDao.java
/** * Gets last id of insert statement. Method using that <b>must be annotated * with {@link Transactional} with propagation set to at least SUPPORTS</b> * //www . java2s . c om * @return */ protected Integer getLastId() { Map<String, Object> emptyMap = Collections.emptyMap(); return simpleJdbcTemplate.queryForInt(SQL_IDENTITY, emptyMap); }
From source file:edu.jhuapl.graphs.jfreechart.BarEffectsTest.java
public static JFreeChartGraphSource getSource() throws GraphException { Map<String, Object> emptyMap = Collections.emptyMap(); List<PointInterface> ps1 = new LinkedList<PointInterface>(); ps1.add(new DataPoint(3, "Red", emptyMap)); ps1.add(new DataPoint(5, "Green", emptyMap)); ps1.add(new DataPoint(7, "Blue", emptyMap)); Map<String, Object> s1Meta = new HashMap<String, Object>(); s1Meta.put(GraphSource.SERIES_COLOR, Color.green); DataSeries s1 = new DataSeries(ps1, s1Meta); List<PointInterface> ps2 = new LinkedList<PointInterface>(); Map<String, Object> redMap = new HashMap<String, Object>(1); redMap.put(GraphSource.ITEM_COLOR, Color.red); ps2.add(new DataPoint(5, "Red", redMap)); Map<String, Object> greenMap = new HashMap<String, Object>(1); greenMap.put(GraphSource.ITEM_COLOR, Color.green); ps2.add(new DataPoint(2, "Green", greenMap)); Map<String, Object> blueMap = new HashMap<String, Object>(1); blueMap.put(GraphSource.ITEM_COLOR, Color.blue); ps2.add(new DataPoint(14, "Blue", redMap)); Map<String, Object> s2Meta = new HashMap<String, Object>(); s2Meta.put(GraphSource.SERIES_COLOR, Color.orange); DataSeries s2 = new DataSeries(ps2, s2Meta); Map<String, Object> graphParams = new HashMap<String, Object>(); graphParams.put(GraphSource.GRAPH_TYPE, GraphSource.GRAPH_TYPE_BAR); graphParams.put(JFreeChartBarGraphSource.PLOT_ORIENTATION, PlotOrientation.HORIZONTAL); graphParams.put(GraphSource.GRAPH_LEGEND, true); JFreeChartGraphSource source = new JFreeChartGraphSource(); source.setData(Arrays.asList(s1, s2)); source.setParams(graphParams);//from w w w . ja v a2 s . co m source.initialize(); return source; }
From source file:io.hops.hopsworks.api.zeppelin.rest.message.NotebookRepoSettingsRequest.java
public NotebookRepoSettingsRequest() { name = StringUtils.EMPTY; settings = Collections.emptyMap(); }
From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.WikiParserUtils.java
public static List<GWikiFragment> parseText(String wikiText) { Map<String, GWikiMacroFactory> macroFactories = Collections.emptyMap(); return parseText(wikiText, macroFactories); }