From f426900ead578d2e90b762c458d1210d735600cc Mon Sep 17 00:00:00 2001 From: Shu Date: Mon, 12 Jan 2026 03:21:52 -0500 Subject: [PATCH 1/3] [Term Entry] add documentatation for Dart Queue: .removeLast() function #8147 --- .../queue/terms/removeLast/removeLast.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 content/dart/concepts/queue/terms/removeLast/removeLast.md diff --git a/content/dart/concepts/queue/terms/removeLast/removeLast.md b/content/dart/concepts/queue/terms/removeLast/removeLast.md new file mode 100644 index 00000000000..d0faf888aff --- /dev/null +++ b/content/dart/concepts/queue/terms/removeLast/removeLast.md @@ -0,0 +1,53 @@ +--- +Title: '.removeLast()' +Description: 'Removes and returns the last element from a queue.' +Subjects: + - 'Code Foundations' + - 'Computer Science' +Tags: + - 'Dart' + - 'Methods' + - 'Queues' + - 'Data Structures' +CatalogContent: + - 'learn-dart' + - 'paths/computer-science' +--- + +The **`.removeLast()`** method removes and returns the last element of a `Queue`. +If the queue is empty, it throws a `StateError` + +## Syntax + +```pseudo +queue.removeLast() +``` + +## Example + +In the following example, the element `5` is removed from the queue using the `.remove()` method: + +```dart +import 'dart:collection'; + +void main() { + // Create a queue + Queue queue = Queue.from([1, 2, 3, 4, 5]); + + // Output the original queue + print('Original Queue: $queue'); + + // Remove the last element from the queue + queue.removeLast(); + + // Output the modified queue + print('Modified Queue: $queue'); +} +``` + +The above code results in the following output: + +```shell +Original Queue: {1, 2, 3, 4, 5} +Modified Queue: {1, 2, 3, 4} +``` From 47a98e8a97adafd9e19a7ca9f4b5ad3006f73d76 Mon Sep 17 00:00:00 2001 From: Shu Date: Mon, 12 Jan 2026 20:59:47 -0500 Subject: [PATCH 2/3] fix typo --- content/dart/concepts/queue/terms/removeLast/removeLast.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/dart/concepts/queue/terms/removeLast/removeLast.md b/content/dart/concepts/queue/terms/removeLast/removeLast.md index d0faf888aff..ade82be684a 100644 --- a/content/dart/concepts/queue/terms/removeLast/removeLast.md +++ b/content/dart/concepts/queue/terms/removeLast/removeLast.md @@ -15,7 +15,7 @@ CatalogContent: --- The **`.removeLast()`** method removes and returns the last element of a `Queue`. -If the queue is empty, it throws a `StateError` +If the queue is empty, it throws a `StateError`. ## Syntax @@ -25,7 +25,7 @@ queue.removeLast() ## Example -In the following example, the element `5` is removed from the queue using the `.remove()` method: +In the following example, the element `5` is removed from the queue using the `.removeLast()` method: ```dart import 'dart:collection'; From bc7a71e47e584ddca29b83f7ef1a9065e8459857 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Tue, 13 Jan 2026 12:44:19 +0530 Subject: [PATCH 3/3] Fix formatting and clean up tags in removeLast.md Updated formatting and removed duplicate tag in the removeLast.md file. --- .../concepts/queue/terms/removeLast/removeLast.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/content/dart/concepts/queue/terms/removeLast/removeLast.md b/content/dart/concepts/queue/terms/removeLast/removeLast.md index ade82be684a..b74dcdceb6b 100644 --- a/content/dart/concepts/queue/terms/removeLast/removeLast.md +++ b/content/dart/concepts/queue/terms/removeLast/removeLast.md @@ -6,16 +6,15 @@ Subjects: - 'Computer Science' Tags: - 'Dart' + - 'Data Structures' - 'Methods' - 'Queues' - - 'Data Structures' CatalogContent: - 'learn-dart' - 'paths/computer-science' --- -The **`.removeLast()`** method removes and returns the last element of a `Queue`. -If the queue is empty, it throws a `StateError`. +The **`.removeLast()`** method removes and returns the last element of a `Queue`. If the queue is empty, it throws a `StateError`. ## Syntax @@ -23,6 +22,14 @@ If the queue is empty, it throws a `StateError`. queue.removeLast() ``` +**Parameters:** + +This method takes no parameters. + +**Return value:** + +Returns the element that was removed from the end of the queue. + ## Example In the following example, the element `5` is removed from the queue using the `.removeLast()` method: