You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2016/09/09 00:39:51 UTC
[2/2] groovy git commit: Documentation fixes to [The Groocy
Development Kit](http://groovy-lang.org/groovy-dev-kit.html) section on
Working with collections - property access comment targets entry instead of
key - two introductions followed by two corres
Documentation fixes to [The Groocy Development Kit](http://groovy-lang.org/groovy-dev-kit.html) section on Working with collections
- property access comment targets entry instead of key
- two introductions followed by two corresponding code sections
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/97f74ed2
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/97f74ed2
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/97f74ed2
Branch: refs/heads/GROOVY_2_4_X
Commit: 97f74ed20f34469d2c08e54a208dc18784b0ccdd
Parents: 776ea2c
Author: Karsten Tinnefeld <k....@gmail.com>
Authored: Fri Sep 9 00:49:06 2016 +0200
Committer: John Wagenleitner <jw...@apache.org>
Committed: Thu Sep 8 17:38:59 2016 -0700
----------------------------------------------------------------------
src/spec/doc/working-with-collections.adoc | 5 +++++
src/spec/test/gdk/WorkingWithCollectionsTest.groovy | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/97f74ed2/src/spec/doc/working-with-collections.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/working-with-collections.adoc b/src/spec/doc/working-with-collections.adoc
index 9fb2d14..859a535 100644
--- a/src/spec/doc/working-with-collections.adoc
+++ b/src/spec/doc/working-with-collections.adoc
@@ -431,6 +431,11 @@ include::{projectdir}/src/spec/test/gdk/WorkingWithCollectionsTest.groovy[tags=s
It is worth noting that negative indices are allowed, to extract more easily from the end of a collection:
+[source,groovy]
+---------------------------------
+include::{projectdir}/src/spec/test/gdk/WorkingWithCollectionsTest.groovy[tags=subscript_3,indent=0]
+---------------------------------
+
You can use negative indices to count from the end of the List, array,
String etc.
http://git-wip-us.apache.org/repos/asf/groovy/blob/97f74ed2/src/spec/test/gdk/WorkingWithCollectionsTest.groovy
----------------------------------------------------------------------
diff --git a/src/spec/test/gdk/WorkingWithCollectionsTest.groovy b/src/spec/test/gdk/WorkingWithCollectionsTest.groovy
index 5d22dd8..3b432d3 100644
--- a/src/spec/test/gdk/WorkingWithCollectionsTest.groovy
+++ b/src/spec/test/gdk/WorkingWithCollectionsTest.groovy
@@ -443,7 +443,7 @@ class WorkingWithCollectionsTest extends GroovyTestCase {
void testMapPropertyNotation() {
// tag::map_property[]
def map = [name: 'Gromit', likes: 'cheese', id: 1234]
- assert map.name == 'Gromit' // can be used instead of map.get('Gromit')
+ assert map.name == 'Gromit' // can be used instead of map.get('name')
assert map.id == 1234
def emptyMap = [:]
@@ -721,10 +721,12 @@ class WorkingWithCollectionsTest extends GroovyTestCase {
text = "nice cheese gromit!"
x = text[-1]
assert x == "!"
+ // end::subscript_4[]
+ // tag::subscript_4a[]
def name = text[-7..-2]
assert name == "gromit"
- // end::subscript_4[]
+ // end::subscript_4a[]
// tag::subscript_5[]
text = "nice cheese gromit!"