Created
January 29, 2015 14:24
-
-
Save azenla/dbd7f2d5a3b6c6306e90 to your computer and use it in GitHub Desktop.
Data Structures in Dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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