Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify collection emptiness check #1462

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public void processFragment(MModelFragments fragmentsContainer, MModelFragment f
log(LogLevel.DEBUG, "Nothing to merge for fragment {} of {}", contributorURI, //$NON-NLS-1$
contributorName);
}
if (evalImports && fragmentsContainer.getImports().size() > 0) {
if (evalImports && !fragmentsContainer.getImports().isEmpty()) {
resolveImports(fragmentsContainer.getImports(), addedElements);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public MUIElement find(String id, MUIElement searchRoot) {
}

List<MUIElement> elements = findElements(searchRoot, id, MUIElement.class);
if (elements.size() > 0) {
if (!elements.isEmpty()) {
return elements.get(0);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ && isValid(perspective, candidate)) {

List<MPart> activeCandidates = modelService.findElements(perspective, null, MPart.class,
singletonList(EPartService.ACTIVE_ON_CLOSE_TAG));
if (activeCandidates.size() > 0) {
if (!activeCandidates.isEmpty()) {
activeCandidates.get(0).getTags().remove(EPartService.ACTIVE_ON_CLOSE_TAG);
MPart candidate = activeCandidates.get(0);
if (partService.isInContainer(perspective, candidate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ private void internalFixContext(MPart part, MUIElement oldSelectedElement) {
@Override
public MPart findPart(String id) {
List<MPart> parts = getParts(MPart.class, id);
return parts.size() > 0 ? parts.get(0) : null;
return parts.isEmpty() ? null : parts.get(0);
}

private <T> List<T> getParts(Class<T> cls, String id) {
Expand Down Expand Up @@ -1020,7 +1020,7 @@ private MPart addPart(MPart providedPart, MPart localPart) {
} else {
// Find the first visible stack in the area
List<MPartStack> sharedStacks = modelService.findElements(area, null, MPartStack.class);
if (sharedStacks.size() > 0) {
if (!sharedStacks.isEmpty()) {
for (MPartStack stack : sharedStacks) {
if (stack.isToBeRendered()) {
stack.getChildren().add(providedPart);
Expand Down Expand Up @@ -1085,7 +1085,7 @@ private void addToLastContainer(String category, MPart part) {
descId += ":*"; //$NON-NLS-1$
List<MPlaceholder> phList = modelService.findElements(workbenchWindow, descId,
MPlaceholder.class, null, EModelService.PRESENTATION);
if (phList.size() > 0) {
if (!phList.isEmpty()) {
MUIElement phParent = phList.get(0).getParent();
if (phParent instanceof MPartStack) {
MPartStack theStack = (MPartStack) phParent;
Expand Down
Loading