我想在rolePriority中找到最小號碼。我如何在for循環中獲得最小數字。如何在循環中找到最小數量?
UserRole.java
public class UserRole implements Serializable{
private Integer id;
private User user;
private Role role;
RoleAction.java
public class RoleAction implements Serializable{ private Integer id; private Role role; private Action action; }
for (UserRole userRole : userRoles) {
dbRoles.add(userRole.getRole().getRoleName());
int rolePriority=userRole.getRole().getPriority();
for (RoleAction ra: userRole.getRole().getRoleActions()) {
System.out.println("#########"+ra.getAction().getName());
System.out.println("@@@@@@@@@"+ra.getAction().getId());
map.put(ra.getAction().getName(), ra.getAction().getId());
}
}
post'UserRole','RoleAction'和格式代碼 –
*「我怎樣才能在for循環中獲得最小數字。」*好吧,你會發生什麼?你覺得你可能會怎麼做?提示:它將涉及一個變量和'<'運算符。 –