Behavioral.Iterator.Iterator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A iterateItems() 0 9 2
A Iterator(List) 0 2 1
1
/*
2
 * @author  : Jagepard <[email protected]>
3
 * @license https://mit-license.org/ MIT
4
 */
5
6
package Behavioral.Iterator;
7
8
import java.util.List;
9
10
public class Iterator implements IteratorInterface{
11
12
    private final List<ItemInterface> bucket;
13
14
    public Iterator(List<ItemInterface> bucket) {
15
        this.bucket = bucket;
16
    }
17
18
    @Override
19
    public String iterateItems() {
20
        StringBuilder output = new StringBuilder();
21
22
        for (ItemInterface item : bucket) {
23
            output.append(String.format("%s %s %s\n", item.getName(), item.getPrice(), item.getDescription()));
24
        }
25
26
        return output.toString();
27
    }
28
}
29