GapList.getAllByKey1(date)

20 views
Skip to first unread message

olb...@jpartner.de

unread,
Apr 21, 2015, 5:52:36 AM4/21/15
to brownies-c...@googlegroups.com
Hi Thomas,

very good work, these brownies collections.
But it need a good forum plattform to quickly solve questians and answers and bug fixing.

My Question (newby) is....
I expected subSet.getFirst() to deliver an element of type DuladiCurveElement, but it delivers
an object of type Date which are the keys (key1). Is that right?


Date x = new Date();
GapList<DuladiCurveElement> subSet = list.getAllByKey1(x);
        logger.info(subSet.getFirst());
        logger.info(subSet.getLast());

Thats not consistent....

  /**
     * Returns a list with all elements with the specified key.
     *
     * @param keyIndex    key index
     * @param key       key which elements must have
     * @return          list with all keys (null if key is null)
     */
    public GapList<E> getAllByKey(int keyIndex, Object key) {
        return keyColl.getAllByKey(keyIndex, key);
    }

regards markus

Thomas Mauch

unread,
Apr 21, 2015, 7:40:06 AM4/21/15
to brownies-c...@googlegroups.com
Hi Markus

Happy to hear you like it.
However I am not able to understand your example.
Running my appended code prints

[Col1 (varchar(1))]
Col1 (varchar(1))


as expected.
Please provide a full example if you encounter further problems.

Regards,
Thomas


public class RunExamples {

    public static void main(String[] args) {
        test();
    }
   
    static void test() {
        Key1List<Column,String> list = new Key1List.Builder<Column,String>().withKey1Map(Column::getName).withPrimaryKey1().build();
        list.add(new Column("Col1", "varchar(1)"));
        list.add(new Column("Col2", "varchar(2)"));
       
        IList<Column> columns = list.getAllByKey1("Col1");
        System.out.println(columns);
        Column col1 = columns.getFirst();
        System.out.println(col1);
    }

    static class Column {
        String name;
        String type;

        public Column(String name, String type) {
            this.name = name;
            this.type = type;
        }

        public String getName() {
            return name;
        }

        public String getType() {
            return type;
        }
       
        @Override
        public String toString() {
            return name + " (" + type + ")";
        }
    }
}

olb...@jpartner.de

unread,
Apr 22, 2015, 2:25:01 AM4/22/15
to brownies-c...@googlegroups.com
Have a look here, i used version 0.9.7 with Java 7.
That description is not consistent....
Whats right, return Elements or return keys 

olb...@jpartner.de

unread,
Apr 22, 2015, 2:29:29 AM4/22/15
to brownies-c...@googlegroups.com
here is my code

DuladiCurveElement.java
GttCurveElement.java
Test1.java

Thomas Mauch

unread,
Apr 22, 2015, 3:11:03 AM4/22/15
to brownies-c...@googlegroups.com
You're right the description is inconsistent.
It should read like this:


    /**
     * Returns a list with all elements with the specified key.
     *
     * @param keyIndex    key index
     * @param key       key which elements must have
     * @return          list with all elements

Thomas Mauch

unread,
Apr 22, 2015, 11:26:03 AM4/22/15
to brownies-c...@googlegroups.com
Hi Markus

With your code, I was able to reproduce the problem.
There is a bug in the handling of ordered lists. If you comment "withKey1OrderBy(true)" out, it works as expected.
I will try to fix it.

Regards,
Thomas

Thomas Mauch

unread,
Apr 23, 2015, 6:20:47 PM4/23/15
to brownies-c...@googlegroups.com
Hi Markus

I published new version 0.9.10 which should fix the problem.
Please try it out.

Regards,
Thomas

Markus Olbrich

unread,
Apr 24, 2015, 8:52:56 AM4/24/15
to brownies-c...@googlegroups.com

Hi Thomas,

 

ok ill try ,

thanks

--
Sie erhalten diese Nachricht, weil Sie in Google Groups ein Thema der Gruppe "brownies-collections" abonniert haben.
Wenn Sie sich von diesem Thema abmelden möchten, rufen Sie https://groups.google.com/d/topic/brownies-collections/ufaII8fm8TA/unsubscribe auf.
Wenn Sie sich von dieser Gruppe und allen Themen dieser Gruppe abmelden möchten, senden Sie eine E-Mail an brownies-collect...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages