Here you can find the source of mergeImportedPermissionsWithExistingPermissions( Map
public static Map<Long, String[]> mergeImportedPermissionsWithExistingPermissions( Map<Long, Set<String>> existingRoleIdsToActionIds, Map<Long, String[]> importedRoleIdsToActionIds)
//package com.java2s; /**/*from w w w . j av a 2 s. co m*/ * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library 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 Lesser General Public License for more * details. */ import java.util.HashMap; import java.util.Map; import java.util.Set; public class Main { public static Map<Long, String[]> mergeImportedPermissionsWithExistingPermissions( Map<Long, Set<String>> existingRoleIdsToActionIds, Map<Long, String[]> importedRoleIdsToActionIds) { Map<Long, String[]> mergedRoleIdsToActionIds = new HashMap<>(); for (Map.Entry<Long, Set<String>> roleIdsToActionIds : existingRoleIdsToActionIds.entrySet()) { long roleId = roleIdsToActionIds.getKey(); if (importedRoleIdsToActionIds.containsKey(roleId)) { String[] actionIds = importedRoleIdsToActionIds.remove(roleId); mergedRoleIdsToActionIds.put(roleId, actionIds); } else { mergedRoleIdsToActionIds.put(roleId, new String[0]); } } mergedRoleIdsToActionIds.putAll(importedRoleIdsToActionIds); return mergedRoleIdsToActionIds; } }