mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
style: enable NeedBraces in checkstyle (#5227)
* enable style NeedBraces * style: enable NeedBraces in checkstyle --------- Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:
committed by
GitHub
parent
51fcc66345
commit
87b17e0571
@@ -24,7 +24,9 @@ public class CircularBuffer<Item> {
|
||||
}
|
||||
|
||||
public Item get() {
|
||||
if (isEmpty()) return null;
|
||||
if (isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = buffer[getPointer.getAndIncrement()];
|
||||
size.decrementAndGet();
|
||||
@@ -32,7 +34,9 @@ public class CircularBuffer<Item> {
|
||||
}
|
||||
|
||||
public boolean put(Item item) {
|
||||
if (isFull()) return false;
|
||||
if (isFull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
buffer[putPointer.getAndIncrement()] = item;
|
||||
size.incrementAndGet();
|
||||
@@ -49,7 +53,9 @@ public class CircularBuffer<Item> {
|
||||
}
|
||||
|
||||
public int getAndIncrement() {
|
||||
if (pointer == max) pointer = 0;
|
||||
if (pointer == max) {
|
||||
pointer = 0;
|
||||
}
|
||||
int tmp = pointer;
|
||||
pointer++;
|
||||
return tmp;
|
||||
|
||||
Reference in New Issue
Block a user