Add ol.structs.LinkedMap.prototype.peekLastKey
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
// FIXME replace this with goog.structs.LinkedMap when goog.structs.LinkedMap
|
||||||
|
// adds peekLastKey()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview A LinkedMap data structure that is accessed using key/value
|
* @fileoverview A LinkedMap data structure that is accessed using key/value
|
||||||
* pairs like an ordinary Map, but which guarantees a consistent iteration
|
* pairs like an ordinary Map, but which guarantees a consistent iteration
|
||||||
@@ -164,6 +167,16 @@ ol.structs.LinkedMap.prototype.peekLast = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the key of the last node without making any modifications.
|
||||||
|
* @return {string|undefined} The key of the last node or undefined if the map
|
||||||
|
* is empty.
|
||||||
|
*/
|
||||||
|
ol.structs.LinkedMap.prototype.peekLastKey = function() {
|
||||||
|
return this.head_.prev.key;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the first node from the list and returns its value.
|
* Removes the first node from the list and returns its value.
|
||||||
* @return {*} The value of the popped node, or undefined if the map was empty.
|
* @return {*} The value of the popped node, or undefined if the map was empty.
|
||||||
|
|||||||
Reference in New Issue
Block a user