当前位置: 首页>>代码示例>>C#>>正文


C# ArrayStack.contains方法代码示例

本文整理汇总了C#中ArrayStack.contains方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayStack.contains方法的具体用法?C# ArrayStack.contains怎么用?C# ArrayStack.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayStack的用法示例。


在下文中一共展示了ArrayStack.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: verbosePrintInternal

        /**
         * Implementation providing functionality for {@link #debugPrint} and for
         * {@link #verbosePrint}.  This prints the given map with nice line breaks.
         * If the debug flag is true, it additionally prints the type of the object
         * value.  If the contents of a map include the map itself, then the text
         * <em>(this Map)</em> is printed out.  If the contents include a
         * parent container of the map, the the text <em>(ancestor[i] Map)</em> is
         * printed, where i actually indicates the number of levels which must be
         * traversed in the sequential list of ancestors (e.g. father, grandfather,
         * great-grandfather, etc).
         *
         * @param out  the stream to print to
         * @param label  the label to be used, may be <code>null</code>.
         *  If <code>null</code>, the label is not output.
         *  It typically represents the name of the property in a bean or similar.
         * @param map  the map to print, may be <code>null</code>.
         *  If <code>null</code>, the text 'null' is output
         * @param lineage  a stack consisting of any maps in which the previous
         *  argument is contained. This is checked to avoid infinite recursion when
         *  printing the output
         * @param debug  flag indicating whether type names should be output.
         * @throws NullPointerException if the stream is <code>null</code>
         */
        private static void verbosePrintInternal(
            java.lang.PrintStream outJ,
            Object label,
            java.util.Map<Object, Object> map,
            ArrayStack lineage,
            bool debug)
        {
            printIndent(outJ, lineage.size());

            if (map == null)
            {
                if (label != null)
                {
                    outJ.print(label);
                    outJ.print(" = ");
                }
                outJ.println("null");
                return;
            }
            if (label != null)
            {
                outJ.print(label);
                outJ.println(" = ");
            }

            printIndent(outJ, lineage.size());
            outJ.println("{");

            lineage.push(map);

            for (java.util.Iterator<java.util.MapNS.Entry<Object, Object>> it = map.entrySet().iterator(); it.hasNext(); )
            {
                java.util.MapNS.Entry<Object, Object> entry = it.next();
                Object childKey = entry.getKey();
                Object childValue = entry.getValue();
                if (childValue is java.util.Map<Object, Object> && !lineage.contains(childValue))
                {
                    verbosePrintInternal(
                        outJ,
                        (childKey == null ? "null" : childKey),
                        (java.util.Map<Object, Object>)childValue,
                        lineage,
                        debug);
                }
                else
                {
                    printIndent(outJ, lineage.size());
                    outJ.print(childKey);
                    outJ.print(" = ");

                    int lineageIndex = lineage.indexOf(childValue);
                    if (lineageIndex == -1)
                    {
                        outJ.print(childValue);
                    }
                    else if (lineage.size() - 1 == lineageIndex)
                    {
                        outJ.print("(this Map)");
                    }
                    else
                    {
                        outJ.print(
                            "(ancestor["
                                + (lineage.size() - 1 - lineageIndex - 1)
                                + "] Map)");
                    }

                    if (debug && childValue != null)
                    {
                        outJ.print(' ');
                        outJ.println(childValue.getClass().getName());
                    }
                    else
                    {
                        outJ.println();
                    }
                }
//.........这里部分代码省略.........
开发者ID:gadfly,项目名称:nofs,代码行数:101,代码来源:org.apache.commons.collections.MapUtils.cs


注:本文中的ArrayStack.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。