Skip to content

Commit 77d6fee

Browse files
committed
Removing deprecated members
1 parent a04f781 commit 77d6fee

File tree

3 files changed

+5
-66
lines changed

3 files changed

+5
-66
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
3434
- `liftA2` receives more parameters to aid inference
3535
- `Compose#getCompose` now supports inference
3636

37+
### Removed
38+
- `MapLens#mappingValues`, deprecated in a prior release
39+
- `CollectionLens#asSet`, deprecated in a prior release
40+
- `CollectionLens#asStream`, deprecated in a prior release
41+
3742
## [3.0.3] - 2018-05-27
3843
### Added
3944
- `Lens#toIso`, for converting a lens to an iso

src/main/java/com/jnape/palatable/lambda/lens/lenses/CollectionLens.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ public static <X, CX extends Collection<X>> Lens.Simple<CX, CX> asCopy(Function<
3131
return simpleLens(copyFn, (__, copy) -> copy);
3232
}
3333

34-
/**
35-
* Convenience static factory method for creating a lens that focuses on an arbitrary {@link Collection} as a
36-
* {@link Set}.
37-
*
38-
* @param <X> the collection element type
39-
* @param <CX> the type of the collection
40-
* @return a lens that focuses on a Collection as a Set
41-
* @deprecated in favor of lawful {@link CollectionLens#asSet(Function)}
42-
*/
43-
@Deprecated
44-
public static <X, CX extends Collection<X>> Lens.Simple<CX, Set<X>> asSet() {
45-
return simpleLens(HashSet::new, (xsL, xsS) -> {
46-
xsL.retainAll(xsS);
47-
return xsL;
48-
});
49-
}
50-
5134
/**
5235
* Convenience static factory method for creating a lens that focuses on an arbitrary {@link Collection} as a
5336
* {@link Set}.
@@ -69,23 +52,6 @@ public static <X, CX extends Collection<X>> Lens.Simple<CX, Set<X>> asSet(
6952
});
7053
}
7154

72-
/**
73-
* Convenience static factory method for creating a lens that focuses on a Collection as a Stream.
74-
*
75-
* @param <X> the collection element type
76-
* @param <CX> the type of the collection
77-
* @return a lens that focuses on a Collection as a stream.
78-
* @deprecated in favor of lawful {@link CollectionLens#asStream(Function)}
79-
*/
80-
@Deprecated
81-
public static <X, CX extends Collection<X>> Lens.Simple<CX, Stream<X>> asStream() {
82-
return simpleLens(Collection::stream, (xsL, xsS) -> {
83-
xsL.clear();
84-
xsS.forEach(xsL::add);
85-
return xsL;
86-
});
87-
}
88-
8955
/**
9056
* Convenience static factory method for creating a lens that focuses on a Collection as a Stream.
9157
* <p>

src/main/java/com/jnape/palatable/lambda/lens/lenses/MapLens.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
import java.util.HashSet;
1313
import java.util.Map;
1414
import java.util.Set;
15-
import java.util.function.Function;
1615

1716
import static com.jnape.palatable.lambda.adt.Maybe.maybe;
18-
import static com.jnape.palatable.lambda.functions.builtin.fn2.Eq.eq;
1917
import static com.jnape.palatable.lambda.functions.builtin.fn2.Map.map;
2018
import static com.jnape.palatable.lambda.functions.builtin.fn2.ToCollection.toCollection;
2119
import static com.jnape.palatable.lambda.functions.builtin.fn2.ToMap.toMap;
@@ -149,36 +147,6 @@ public static <K, V> Lens.Simple<Map<K, V>, Map<V, K>> inverted() {
149147
});
150148
}
151149

152-
/**
153-
* A lens that focuses on a map while mapping its values with the mapping function.
154-
* <p>
155-
* Note that this lens is very likely to NOT be lawful, since "you get back what you put in" will fail for all
156-
* values <code>B</code> that do not map from the current values in <code>S</code> (new mappings cannot be
157-
* preserved as the inversion of <code>fn</code> is not known). Furthermore, if <code>fn</code> is injective
158-
* (multiple <code>V</code>s map to the same <code>V2</code>), this lens will also not be lawful for similar reasons
159-
* as stated above.
160-
*
161-
* @param fn the mapping function
162-
* @param <K> the key type
163-
* @param <V> the unfocused map value type
164-
* @param <V2> the focused map value types
165-
* @return a lens that focuses on a map while mapping its values
166-
* @deprecated in favor of the lawful (and far more rational) {@link MapLens#mappingValues(Iso)}
167-
*/
168-
@Deprecated
169-
public static <K, V, V2> Lens.Simple<Map<K, V>, Map<K, V2>> mappingValues(Function<? super V, ? extends V2> fn) {
170-
return simpleLens(m -> toMap(HashMap::new, map(t -> t.biMapR(fn), map(Tuple2::fromEntry, m.entrySet()))),
171-
(s, b) -> {
172-
Set<K> retainKeys = Filter.<Map.Entry<K, V>>filter(kv -> eq(fn.apply(kv.getValue()), b.get(kv.getKey())))
173-
.andThen(map(Map.Entry::getKey))
174-
.andThen(toCollection(HashSet::new))
175-
.apply(s.entrySet());
176-
Map<K, V> copy = new HashMap<>(s);
177-
copy.keySet().retainAll(retainKeys);
178-
return copy;
179-
});
180-
}
181-
182150
/**
183151
* A lens that focuses on a map while mapping its values with the mapping {@link Iso}.
184152
* <p>

0 commit comments

Comments
 (0)