Point readPoint() {
...
}
Points readPoints() {
...
}
Point point = readPoint();
if (point != null) {
...
}
Points points = readPoints();
if (points != null) {
...
}
Points points = readPoints();
for (Point point : points) {
...
}
Point readPoint() throws PointNotFoundException {
...
}
Points readPoints() throws CouldNotReadPointsException {
...
}
try {
Point point = readPoint();
...
} catch(PointNotFoudException ex) {
...
}
try {
Points points = readPoints();
for (Point point : points) {
...
}
} catch(CouldNotReadPointsException ex) {
...
}
while (!queue.isEmpty()) {
Point point = queue.readPoint();
if (point != null) {
...
}
}
try {
while (!queue.isEmpty()) {
Point point = queue.readPoint();
...
}
} catch(PointNotFoudException ex) {
throw new QueueReadingException(ex);
}
try {
while (!queue.isEmpty()) {
processNextPoint();
}
} catch(PointNotFoudException ex) {
throw new QueueReadingException(ex);
}
void processNextPoint() throws PointNotFoudException {
Point point = queue.readPoint();
...
}
Source: https://habr.com/ru/post/130534/
All Articles