isEmpty for maps

This commit is contained in:
Egor.Ushakov
2016-03-09 20:17:53 +03:00
parent ad8b09c8e4
commit f17ab80c1d
2 changed files with 8 additions and 2 deletions
@@ -26,6 +26,7 @@ import com.intellij.psi.JavaRecursiveElementVisitor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiLocalVariable;
import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
@@ -87,7 +88,7 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory {
XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
Map<?, ValueMarkup> markupMap = markers != null ? markers.getAllMarkers() : null;
//final Map<ObjectReference, ValueMarkup> markupMap = ValueDescriptorImpl.getMarkupMap(process);
if (markupMap != null && markupMap.size() > 0) {
if (ContainerUtil.isEmpty(markupMap)) {
final Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap);
int offset = markupVariables.getFirst().length() - 1;
final TextWithImportsImpl textWithImports = new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, markupVariables.getFirst(), "", myDelegate.getFileType());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2702,6 +2702,11 @@ public class ContainerUtil extends ContainerUtilRt {
return collection == null || collection.isEmpty();
}
@Contract(value = "null -> true", pure = true)
public static boolean isEmpty(Map map) {
return map == null || map.isEmpty();
}
@NotNull
@Contract(pure=true)
public static <T> List<T> notNullize(@Nullable List<T> list) {