Ian, My issue is that the contract as spelled out in the documentation is not always kept. From the documentation I would assume that a copy is returned thus I can execute:
L3 = L1.append( L2 ); L3.removeHead() and not have L1 or L2 affected. However if L1==nill then L3.removeHead() removes the head of L2. conversely, from the documentation I would expect that L3 = L1.append( L2 ); L2.removeHead() would not impact L3 but it does in the case where L1=nill Disclaimer: I am new to the RDFList construct so perhaps I am missing something. -- Claude On Sun, Nov 25, 2012 at 12:30 AM, Ian Dickinson (JIRA) <[email protected]> wrote: > > [ > https://issues.apache.org/jira/browse/JENA-353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13503443#comment-13503443 > ] > > Ian Dickinson commented on JENA-353: > ------------------------------------ > > What's the use case when this makes a difference? The documentation is > correct: when you do > > L1.append( L2 ) > > where L1 == nil, the post-condition remains true that neither list has a > different set of triples than it did before the append operation. If your > application needs to copy the list so that the appended list (or the > original) can be side-effected by other code, you have `RDFList.copy`. I'm > happy to consider changes to the current contract, but the motivation needs > to be clearer. Copying a list is potentially an expensive operation, so it > should be very clear to the caller when it is going to take place. > >> RDFList.append doc indicates a copy is created not always so. >> ------------------------------------------------------------- >> >> Key: JENA-353 >> URL: https://issues.apache.org/jira/browse/JENA-353 >> Project: Apache Jena >> Issue Type: Bug >> Affects Versions: Jena 2.7.4 >> Reporter: Claude Warren >> >> Documentation for RDFList.append() indicates that a copy is created, both >> lists are merged into the copy and the copy returned so as to be "non >> side-effecting operation on either this list or the given list" >> However, in the case where this list is empty the other list is returned. I >> believe copy of the other should be returned in this case. > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA administrators > For more information on JIRA, see: http://www.atlassian.com/software/jira
