Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: sdk/lib/core/list.dart

Issue 315173005: Add "last" setter to List. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 0b55b8ec0384ad67df417af79f14fc0b5257cab6..aa0d4d34803fdd1f3ad49bc5bd358d62316cfadb 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -154,6 +154,16 @@ abstract class List<E> implements Iterable<E>, EfficientLength {
void set length(int newLength);
/**
+ * Replaces the last element of the list with [value].
+ *
+ * Using `list.last = value` is equivalent to `list[list.length - 1] = value`,
+ * only shorter and more readable.
+ *
+ * The list must be modifiable and must have a length greater than zero.
+ */
+ void set last(E value);
+
+ /**
* Adds [value] to the end of this list,
* extending the length by one.
*

Powered by Google App Engine
This is Rietveld 408576698