Here you can find the source of convertQNameListToNamespaceToLocalNameList( List
public static SortedMap<String, SortedSet<String>> convertQNameListToNamespaceToLocalNameList( List<QName> list)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 University of Stuttgart. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and the Apache License 2.0 which both accompany this distribution, * and are available at http://www.eclipse.org/legal/epl-v10.html * and http://www.apache.org/licenses/LICENSE-2.0 * * Contributors:// w ww .ja va 2 s . c o m * Oliver Kopp - initial API and implementation *******************************************************************************/ import java.util.List; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; import javax.xml.namespace.QName; public class Main { public static SortedMap<String, SortedSet<String>> convertQNameListToNamespaceToLocalNameList( List<QName> list) { SortedMap<String, SortedSet<String>> res = new TreeMap<>(); for (QName qname : list) { SortedSet<String> localNameSet = res.computeIfAbsent(qname.getNamespaceURI(), k -> new TreeSet<>()); localNameSet.add(qname.getLocalPart()); } return res; } }