specialcollectionsproperties.html

来自「ONGL学习的好书,介绍ONGL的相关知识」· HTML 代码 · 共 8 行

HTML
8
字号
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Pseudo-Properties for Collections</title><link href="../docbook.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.65.0" name="generator"><link rel="home" href="index.html" title="OGNL Language Guide"><link rel="up" href="basicExpressions.html" title="Chapter&nbsp;4.&nbsp;Expressions"><link rel="previous" href="lambdaExpressions.html" title="Pseudo-Lambda Expressions"><link rel="next" href="differences.html" title="Operators that differ from Java's operators"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Pseudo-Properties for Collections</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="lambdaExpressions.html"><img src="../images/navigation/prev.gif" alt="Prev"></a>&nbsp;</td><th align="center" width="60%">Chapter&nbsp;4.&nbsp;Expressions</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="differences.html"><img src="../images/navigation/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="specialCollectionsProperties"></a>Pseudo-Properties for Collections</h2></div></div><div></div></div><p>There are some special properties of collections that <span class="acronym">OGNL</span> makes available. The reason for this is that the collections do not follow JavaBeans patterns for method naming; therefore the <tt class="function">size()</tt>,
            <tt class="function">length()</tt>, etc. methods must be called instead of more intuitively referring to these as properties. <span class="acronym">OGNL</span> corrects this by exposing certain pseudo-properties as if they were built-in.</p><div class="table"><a name="N103F2"></a><p class="title"><b>Table&nbsp;4.1.&nbsp;Special Collections Pseudo-Properties</b></p><table summary="Special Collections Pseudo-Properties" border="1"><colgroup><col><col></colgroup><thead><tr><th valign="top">Collection</th><th valign="top">Special Properties</th></tr></thead><tbody><tr><td valign="top"><tt class="classname">Collection</tt> (inherited by <tt class="classname">Map</tt>, <tt class="classname">List</tt> &amp; <tt class="classname">Set</tt>)</td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><tt class="literal">size</tt></span></dt><dd><p>The size of the collection</p></dd><dt><span class="term"><tt class="literal">isEmpty</tt></span></dt><dd><p>Evaluates
                            to <tt class="constant">true</tt> if the collection is empty</p></dd></dl></div></td></tr><tr><td valign="top">List</td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><tt class="literal">iterator</tt></span></dt><dd><p>Evalutes to an <tt class="classname">Iterator</tt> over the <tt class="classname">List</tt>.</p></dd></dl></div></td></tr><tr><td valign="top"><tt class="classname">Map</tt></td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><tt class="literal">keys</tt></span></dt><dd><p>Evalutes to a <tt class="classname">Set</tt> of all keys in the <tt class="classname">Map</tt>.</p></dd><dt><span class="term"><tt class="literal">values</tt></span></dt><dd><p>Evaluates
                            to a <tt class="classname">Collection</tt> of all values in the <tt class="classname">Map</tt>.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Note]" src="../images/admon/note.gif"></td><th align="left">Note</th></tr><tr><td valign="top" align="left" colspan="2"><p>These properties, plus <tt class="literal">size</tt> and <tt class="literal">isEmpty</tt>,
                            are different than the indexed form of access for <tt class="classname">Map</tt>s (i.e. <tt class="literal">someMap["size"]</tt> gets the <tt class="literal">"size"</tt> key from the map, whereas <tt class="literal">someMap.size</tt>
                            gets the size of the <tt class="classname">Map</tt>.</p></td></tr></table></div></td></tr><tr><td valign="top"><tt class="classname">Set</tt></td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><tt class="literal">iterator</tt></span></dt><dd><p>Evalutes to an <tt class="classname">Iterator</tt> over the <tt class="classname">Set</tt>.</p></dd></dl></div></td></tr><tr><td valign="top"><tt class="classname">Iterator</tt></td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><tt class="literal">next</tt></span></dt><dd><p>Evalutes to the next object from the <tt class="classname">Iterator</tt>.</p></dd><dt><span class="term"><tt class="literal">hasNext</tt></span></dt><dd><p>Evaluates
                            to <tt class="constant">true</tt> if there is a next object available from the <tt class="classname">Iterator</tt>.</p></dd></dl></div></td></tr><tr><td valign="top"><tt class="classname">Enumeration</tt></td><td valign="top"><div class="variablelist"><dl><dt><span class="term"><a name="Enumeration.next"></a><tt class="literal">next</tt></span></dt><dd><p>Evalutes to the next object from the <tt class="classname">Enumeration</tt>.</p></dd><dt><span class="term"><a name="Enumeration.hasNext"></a><tt class="literal">hasNext</tt></span></dt><dd><p>Evaluates to <tt class="constant">true</tt> if there is a next object available from the <tt class="classname">Enumeration</tt>.</p></dd><dt><span class="term"><tt class="literal">nextElement</tt></span></dt><dd><p>Synonym
                            for <tt class="literal"><a href="specialCollectionsProperties.html#Enumeration.next">next</a></tt>.</p></dd><dt><span class="term"><tt class="literal">hasMoreElements</tt></span></dt><dd><p>Synonym for <tt class="literal"><a href="specialCollectionsProperties.html#Enumeration.hasNext">hasNext</a></tt>.</p></dd></dl></div></td></tr></tbody></table></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="lambdaExpressions.html"><img src="../images/navigation/prev.gif" alt="Prev"></a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="basicExpressions.html"><img src="../images/navigation/up.gif" alt="Up"></a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="differences.html"><img src="../images/navigation/next.gif" alt="Next"></a></td></tr><tr><td valign="top" align="left" width="40%">Pseudo-Lambda Expressions&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html"><img src="../images/navigation/home.gif" alt="Home"></a></td><td valign="top" align="right" width="40%">&nbsp;Operators that differ from Java's operators</td></tr></table></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?