Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<BagRule> bagsThatCanHoldBag(String sentColor, String sentAttribute, List<BagRule> sentList) {
- List<BagRule> list = new ArrayList<>();
- for (BagRule bag : sentList) {
- BidiMap<String, String> map = bag.getContentsColorAttributeMap();
- String color = map.getKey(sentAttribute);
- String attr = null;
- if (color != null) {
- attr = map.get(color);
- }
- if (color == null || attr == null) {
- continue;
- } else if (!color.equals(sentColor) || !attr.equals(sentAttribute)) {
- continue;
- } else {
- list.add(bag);
- }
- }
- return list;
- }
Add Comment
Please, Sign In to add comment