{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Automatic Table Display of Simple Data Structures\n", "\n", "BeakerX automatically displays Maps and Lists as Tables completely automatically in many circumstances." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "[\"x\" : 1, \"y\" : 2]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "List list = new ArrayList();\n", "list.add([\"x\" : 1, \"y\" : 2]);\n", "list.add([\"x\" : 3, \"y\" : 4]);\n", "list" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "Map[] map = new Map[2];\n", "map[0] = [\"x\" : 1, \"y\" : 2]\n", "map[1] = [\"x\" : 3, \"y\" : 4]\n", "map" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def listOfMap = []\n", "1.upto(10){\n", " listOfMap += [\"test\": it]\n", "}\n", "listOfMap" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def myMap = [:]\n", "def myList = []\n", "myList << [1, 2, 3]\n", "myList << [2, 3, 4]\n", "myMap.put(1, myList)\n", "myMap" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def myMap = [:]\n", "def myList = [num1:1, num2:2]\n", "myMap.put(1, myList)\n", "myMap" ] } ], "metadata": { "beakerx_kernel_parameters": { "classpath": [], "imports": [] }, "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" } }, "nbformat": 4, "nbformat_minor": 2 }