Here you can find the source of prettyPrint(List
public static String prettyPrint(List<String> userPermissions)
//package com.java2s; /******************************************************************************* * Copyright (c) [2012] - [2016] Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w ww . ja v a 2 s . com * Codenvy, S.A. - initial API and implementation *******************************************************************************/ import java.util.List; public class Main { public static String prettyPrint(List<String> userPermissions) { if (userPermissions == null) { return ""; } StringBuilder sb = new StringBuilder(""); if (userPermissions.contains("read")) { sb.append("R"); } if (userPermissions.contains("write")) { sb.append("W"); } // build permission if before the run if (userPermissions.contains("build")) { sb.append("B"); } if (userPermissions.contains("run")) { sb.append("X"); } // Update ACL should be the last permission if (userPermissions.contains("update_acl")) { sb.append("U"); } return sb.toString(); } }