Skip to content

Instantly share code, notes, and snippets.

@azenla
Created January 29, 2015 14:24
Show Gist options
  • Save azenla/dbd7f2d5a3b6c6306e90 to your computer and use it in GitHub Desktop.
Save azenla/dbd7f2d5a3b6c6306e90 to your computer and use it in GitHub Desktop.
Data Structures in Dart
import "dart:collection";
class Tuple<A, B> {
A a;
B b;
Tuple(this.a, this.b);
}
void main() {
// List (Essentially an Array)
var list = [1, 2, 3, 4];
// Set (One of Each Item)
var set = new Set<int>.from([1, 2, 3, 4]);
// Queue (Both a FIFO and a LIFO structure)
var queue = new Queue<int>([1, 2, 3, 4]);
// Tuple (Two Items)
var tuple = new Tuple<String, int>("Alex", 15);
// Map (Map of a Key to a Value)
var map = { "name": "Alex", "age": 15 };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment