Comments (5)
Hi Paul,
of course I have no reason to not believe in you. Indeed the scenario you are
experiencing is very worrying. If what you are reporting is true (and once
again I haven't any reason to think the opposite), you can imagine that should
be unbearable to have an interface with both the size() and getSize() methods
that even worse return 2 different values. And I also cannot safely remove the
getSize() method without breaking the backward compatibility. I am not saying I
don't want to do that at all, but I need a very good reason to do that. I hope
you can agree.
Since I am also very curious of what you found and also to properly write an
unit test for this issue, I'd be glad if you could give me a bit more details
about it.
Thanks a lot
Mario
Original comment by [email protected]
on 30 Aug 2010 at 9:09
from lambdaj.
// both of these fail.
package ch.lambdaj;
import ch.lambdaj.demo.Person;
import ch.lambdaj.group.Group;
import org.junit.Test;
import static ch.lambdaj.Lambda.by;
import static ch.lambdaj.Lambda.group;
import static ch.lambdaj.Lambda.on;
import static java.util.Arrays.asList;
import static junit.framework.Assert.assertEquals;
public class GroupsVarianceTest {
private Person mario1 = new Person("Mario", "Fusco", true, "01/01/1999" );
private Person peter = new Person("Peter", "Pan", true, "02/02/1999" );
private Person mario2 = new Person("Mario", "Two", true, "04/04/1999");
@Test
public void oneGroupsRecognizedSuggestingNoVariance() {
Group<Person> grp = group(asList(mario1, mario2), by(on(Person.class).getFirstName()));
assertEquals(1, grp.getSize());
}
@Test
public void twoGroupsRecognizedSuggestingVariance() {
Group<Person> grp = group(asList(mario1, peter, mario2), by(on(Person.class).getFirstName()));
assertEquals(2, grp.getSize());
}
}
// I must be misunderstanding the doco.. my apologies of this is the case.
Original comment by [email protected]
on 30 Aug 2010 at 11:27
from lambdaj.
The interesting thing about this, is that as you gaze at 'grp' in the debugger,
the toString() is reporting the right numbers - "size = 1" for the first test
and "size = 2" for the second.
Original comment by [email protected]
on 31 Aug 2010 at 4:21
from lambdaj.
Well our problem was new useritis.
What we really wanted was either
grp.subgroups().size()
or
grp.keySet().size()
We found that the unit tests as you have them, have one example that shows
this. Perhaps the Group.getSize() javadoc could be changed to:
/**
* Returns how many items are present in this group, wherever they are in the implicit tree-map
*/
Original comment by [email protected]
on 2 Sep 2010 at 12:49
from lambdaj.
Yes, the problem was caused in a misunderstanding in the documentation. The
javadoc of the getSize() method has been updated as per your suggestion.
Original comment by [email protected]
on 16 Sep 2010 at 10:56
- Changed state: Invalid
from lambdaj.
Related Issues (20)
- No way to specify RoundingMode in avgFrom
- Android + maven + lambdaj HOT 2
- Please support describeTo() in OrMatcher/AndMatcher
- Request for nested loop example
- How to get the specified List by using lambdaj
- Class javax.el.BeanELResolver can not access a member of class ch.lambdaj.group.GroupImpl with modifiers "public"
- LambdaList.forEach(Matcher) Exception points to inexistent overloaded method for empty match
- forEach should be overloaded better
- LambdaList.sort( HOT 1
- LambdaList.sort(Object, option) should return LambdaList
- The method on(Class<Contact>) is undefined HOT 2
- Problem with sum if we have null and not null fields HOT 1
- Lambdaj 2.4 can't work fine on the Google Apps Engine
- Create a JDK7 version of Java8's Lambda APIs
- java.util.ConcurrentModificationException
- Different methods returning char/Character-values are mapped to the same Placeholder.
- parent class methods not accessible in some cases HOT 1
- project() conversion using on() statements has erroneous result when using Joda Date
- Gross Lack of efficacy of using LambdaJ for calculating sum in Listof Objects
- Problem with selectDistinct HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lambdaj.