Modify deeply nested fields in case classes:
- Buy Contact Lenses online with low prices from QUICKLENS.Surprisingly low prices on Acuvue Oasys, Focus Daillies, Air Optix, Biofinity, and many other contact lenses.Free shipping on all orders over $120.
- About Quicklens. Visit this Quicklens promotion page for all the latest and best coupon codes and deals and there'll be always a satisfying coupon code for you to apply for instant discounts while.
Quicklens - 15% + Free Shipping on Orders above $120. Posted by 2 hours ago. Books 1-5 $1.49, The Belt Quadrilogy Books 1-4 $.99 by Gerald M. Coupons Quicklens, tory burch factory store coupons, coupon network printable coupons, deals we like ihg. Packages include a 5'x7' and 8'x10' print.
Chain modifications:
Modify conditionally: Templates bundle for iwork – templates guru 5 0.
Modify several fields in one go:
Traverse options/lists/maps using .each
:
.each
can only be used inside a modify
and 'unwraps' the container (currently supports Seq
s, Option
s andMaps
s - only values are unwrapped for maps).You can add support for your own containers by providing an implicit QuicklensFunctor[C]
with the appropriateC
type parameter.
Traverse selected elements using .eachWhere
:
Similarly to .each
, you can use .eachWhere(p)
where p
is a predicate to modify only the elements which satisfythe condition. All other elements remain unchanged.
Modify specific elements in an option/sequence/map using .at
:
Similarly to .each
, .at
modifies only the element at the given index/key. If there's no element at that index,an IndexOutOfBoundsException
is thrown. In the above example, .at(2)
selects an element in addresses: List[Address]
and .at
selects the lone possible element in street: Option[Street]
. If street
is None
, a NoSuchElementException
is thrown.
.at
works for map keys as well:
Similarly to .each
, .at
modifies only the element with the given key. If there's no such element,an NoSuchElementException
is thrown.
Modify specific elements in an option/sequence/map using .index
:
Similarly to .at
, .index
modifies only the element at the given index/key. If there's no element at that index,no modification is made. In the above example, .index(2)
selects an element in addresses: List[Address]
and .index
selects the lone possible element in street: Option[Street]
. If street
is None
, no modification is made.
.index
works for map keys as well:
Similarly to .at
, .index
modifies only the element with the given key. If there's no such element,no modification is made.
Modify specific elements in an option or map with a fallback using .atOrElse
:
If props
contains an entry for 'NumReports'
, then .atOrElse
behaves the same as .at
and the secondparameter is never evaluated. If there is no entry, then .atOrElse
will make one using the second parameter and perform subsequent modifications on the newly instantiated default.
For Options, .atOrElse
takes no arguments and acts similarly.
Traverse selected elements using .eachWhere
:
Similarly to .each
, you can use .eachWhere(p)
where p
is a predicate to modify only the elements which satisfythe condition. All other elements remain unchanged.
Modify specific elements in an option/sequence/map using .at
:
Similarly to .each
, .at
modifies only the element at the given index/key. If there's no element at that index,an IndexOutOfBoundsException
is thrown. In the above example, .at(2)
selects an element in addresses: List[Address]
and .at
selects the lone possible element in street: Option[Street]
. If street
is None
, a NoSuchElementException
is thrown.
.at
works for map keys as well:
Similarly to .each
, .at
modifies only the element with the given key. If there's no such element,an NoSuchElementException
is thrown.
Modify specific elements in an option/sequence/map using .index
:
Similarly to .at
, .index
modifies only the element at the given index/key. If there's no element at that index,no modification is made. In the above example, .index(2)
selects an element in addresses: List[Address]
and .index
selects the lone possible element in street: Option[Street]
. If street
is None
, no modification is made.
.index
works for map keys as well:
Similarly to .at
, .index
modifies only the element with the given key. If there's no such element,no modification is made.
Modify specific elements in an option or map with a fallback using .atOrElse
:
If props
contains an entry for 'NumReports'
, then .atOrElse
behaves the same as .at
and the secondparameter is never evaluated. If there is no entry, then .atOrElse
will make one using the second parameter and perform subsequent modifications on the newly instantiated default.
For Options, .atOrElse
takes no arguments and acts similarly.
.atOrElse
is currently not available for sequences because quicklens might need to insert many elements in the list in order to ensure that one is available at a particular position, and it's not clear that providing one default for all keys is the right behavior.
Modify Either fields using .eachLeft
and .eachRight
:
Modify fields when they are of a certain subtype:
Quicklens 1 89
This is also known as a prism, see e.g. here.
Re-usable modifications (lenses):
Alternate syntax:
Composing lenses:
or, with alternate syntax:
Modify nested sealed hierarchies:
Note: this feature is experimental and might not work due to compilation order issues.See https://issues.scala-lang.org/browse/SI-7046 for more details.
Similar to lenses (1,2), but without the actual lens creation.
Read the blog for more info.
Available in Maven Central:
Taskpaper 3 7 5 – simple to do list. Also available for Scala.js and Scala Native!
Commercial Support
We offer commercial support for Quicklens and related technologies, as well as development services. Contact us to learn more about our offer!
Copyright
Copyright (C) 2015-2019 SoftwareMill https://softwaremill.com.
Quicklens 1 829
|