I am trying to use a lambda expression to evaluate to true or false on whether a input parameter to a method has a certain character '*' at the end of the string; as an input to a constructor to an object. im sure this is way off, but this is what i was trying to do before i looked around the web and saw some referring to using streams, but I'm not sure how or if they would work for this situation:
public void addPermission(String permission, String resource){
permissions.put(new Permission(permission,
()-> {if (permission.charAt(permissions.size() - 1) == '*') return true; }));
}
any input would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire