tvaultapi/src/main/java/com/tmobile/cso/vault/api/controller/ControllerUtil.java
public static Map<String,Object> filterDuplicateSafePermissions(Map<String,Object> access) {
		if (!MapUtils.isEmpty(access)) {
			String[] safeTypes = {TVaultConstants.USERS, TVaultConstants.SHARED, TVaultConstants.APPS};

			for (String type: safeTypes) {
				List<Map<String,String>> safePermissions = (List<Map<String,String>>)access.get(type);
				if (safePermissions != null) {
					//map to check duplicate permission
					Map<String,String> filteredPermissions = Collections.synchronizedMap(new HashMap());
					List<Map<String,String>> updatedPermissionList = new ArrayList<>();
					for (Map<String,String> permissionMap: safePermissions) {
						Set<String> keys = permissionMap.keySet();
						String key = keys.stream().findFirst().orElse("");

						if (!key.equals("") && !filteredPermissions.containsKey(key)) {
							filteredPermissions.put(key, permissionMap.get(key));
							Map<String,String> permission = Collections.synchronizedMap(new HashMap());
							permission.put(key, permissionMap.get(key));
							updatedPermissionList.add(permission);
						}
					}
					access.put(type, updatedPermissionList);
				}
			}
		}
		return access;
	}
/**
	 * To filter the duplicate safe permissions
	 * @param access
	 * @return
	 */
To filter the duplicate safe permissions
@param access
@return
To filter the duplicate safe permissions @param access @return
public static Map<String,Object> filterDuplicateSafePermissions(Map<String,Object> access) {
		if (!MapUtils.isEmpty(access)) {
			String[] safeTypes = {TVaultConstants.USERS, TVaultConstants.SHARED, TVaultConstants.APPS};
			for (String type: safeTypes) {
				List<Map<String,String>> safePermissions = (List<Map<String,String>>)access.get(type);
				if (safePermissions != null) {
					Map<String,String> filteredPermissions = Collections.synchronizedMap(new HashMap());
					List<Map<String,String>> updatedPermissionList = new ArrayList<>();
					for (Map<String,String> permissionMap: safePermissions) {
						Set<String> keys = permissionMap.keySet();
						String key = keys.stream().findFirst().orElse("");
						if (!key.equals("") && !filteredPermissions.containsKey(key)) {
							filteredPermissions.put(key, permissionMap.get(key));
							Map<String,String> permission = Collections.synchronizedMap(new HashMap());
							permission.put(key, permissionMap.get(key));
							updatedPermissionList.add(permission);
						}
					}
					access.put(type, updatedPermissionList);
				}
			}
		}
		return access;
	}
public static Map < String , Object > filterDuplicateSafePermissions ( Map < String , Object > access ) { if ( ! MapUtils . isEmpty ( access ) ) { String [ ] safeTypes = { TVaultConstants . USERS , TVaultConstants . SHARED , TVaultConstants . APPS } ; for ( String type : safeTypes ) { List < Map < String , String > > safePermissions = ( List < Map < String , String > > ) access . get ( type ) ; if ( safePermissions != null ) { Map < String , String > filteredPermissions = Collections . synchronizedMap ( new HashMap ( ) ) ; List < Map < String , String > > updatedPermissionList = new ArrayList < > ( ) ; for ( Map < String , String > permissionMap : safePermissions ) { Set < String > keys = permissionMap . keySet ( ) ; String key = keys . stream ( ) . findFirst ( ) . orElse ( "" ) ; if ( ! key . equals ( "" ) && ! filteredPermissions . containsKey ( key ) ) { filteredPermissions . put ( key , permissionMap . get ( key ) ) ; Map < String , String > permission = Collections . synchronizedMap ( new HashMap ( ) ) ; permission . put ( key , permissionMap . get ( key ) ) ; updatedPermissionList . add ( permission ) ; } } access . put ( type , updatedPermissionList ) ; } } } return access ; }
To filter the duplicate safe permissions
 @param access
 @return
To filter the duplicate safe permissions @param access @return
//map to check duplicate permission