2021-07-21 19:55:20 +00:00
|
|
|
package the.bytecode.club.bytecodeviewer.bootloader.classtree;
|
2018-01-31 15:03:53 +00:00
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
2015-11-11 04:16:45 +00:00
|
|
|
import org.objectweb.asm.tree.ClassNode;
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
|
|
|
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/**
|
2018-01-31 15:03:53 +00:00
|
|
|
* @author Bibl (don't ban me pls)
|
|
|
|
* @created 25 May 2015 (actually before this)
|
2015-11-11 04:16:45 +00:00
|
|
|
*/
|
2018-01-31 15:03:53 +00:00
|
|
|
public class ClassHelper {
|
2015-11-11 04:16:45 +00:00
|
|
|
|
2018-01-31 15:41:24 +00:00
|
|
|
public static Map<String, ClassNode> convertToMap(Collection<ClassNode> classes) {
|
2021-04-12 22:31:22 +00:00
|
|
|
Map<String, ClassNode> map = new HashMap<>();
|
2018-01-31 15:41:24 +00:00
|
|
|
for (ClassNode cn : classes) {
|
|
|
|
map.put(cn.name, cn);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static <T, K> Map<T, K> copyOf(Map<T, K> src) {
|
2021-04-12 22:31:22 +00:00
|
|
|
Map<T, K> dst = new HashMap<>();
|
2018-01-31 15:41:24 +00:00
|
|
|
copy(src, dst);
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static <T, K> void copy(Map<T, K> src, Map<T, K> dst) {
|
2021-12-19 23:24:17 +00:00
|
|
|
dst.putAll(src);
|
2018-01-31 15:41:24 +00:00
|
|
|
}
|
2021-12-19 23:24:17 +00:00
|
|
|
}
|