@Test public void testGetAliasNonExistent() { final Map<String, String> nsContext = new HashMap<>(); final String included1 = NamespaceHandler.INCLUDED_NAMESPACE + "1"; final String ns1 = "http: nsContext.put(included1, ns1); final Optional<Map.Entry<String, String>> actual = NamespaceHandler.getAlias(nsContext, "some"); assertFalse(actual.isPresent()); }
public static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext, final String namespace) { return nsContext.entrySet() .stream() .filter(k -> k.getValue().equals(namespace)) .findFirst(); }
NamespaceHandler { public static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext, final String namespace) { return nsContext.entrySet() .stream() .filter(k -> k.getValue().equals(namespace)) .findFirst(); } }
NamespaceHandler { public static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext, final String namespace) { return nsContext.entrySet() .stream() .filter(k -> k.getValue().equals(namespace)) .findFirst(); }  }
NamespaceHandler { public static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext, final String namespace) { return nsContext.entrySet() .stream() .filter(k -> k.getValue().equals(namespace)) .findFirst(); }  static String addIncludedNamespace(final Map<String, String> nsContext,
                                              final String namespace); static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext,
                                                               final String namespace); }
NamespaceHandler { public static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext, final String namespace) { return nsContext.entrySet() .stream() .filter(k -> k.getValue().equals(namespace)) .findFirst(); }  static String addIncludedNamespace(final Map<String, String> nsContext,
                                              final String namespace); static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext,
                                                               final String namespace);  }