SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-29-2009, 03:22 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Combining HashMaps

If I have two hash maps created by new_java_util_HashMap() how do I combine them into one? I thought I should use java_util_Map_putAll() but I can't get this to work properly. Maybe I have the syntax wrong?

In some cases the two maps I need to combine have no overlapping keys, in other cases the same key may appear in both maps. If the key does exist in both maps I want the resulting combined subgroup to contain all elements. (The same element will never exist in both maps I am trying to combine.)

Thanks in advance,

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #2  
Old 12-29-2009, 04:00 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by tmiranda View Post
Maybe I have the syntax wrong?
I don't mean to be snarky but we can't tell you if it's right or wrong unless you show us what you have.

Quote:
Originally Posted by tmiranda View Post
If the key does exist in both maps I want the resulting combined subgroup to contain all elements.
You will most likely have to write your own code to do that. Map.putAll() doesn't know about the internal structure of the map values and will just replace one value with another without trying to merge them. If the values are arrays or lists and you want them merged, you'll have to do that yourself.
__________________
-- Greg
Reply With Quote
  #3  
Old 12-29-2009, 06:20 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Greg,

For _putAll I tried _putAll(List1, List2) hoping that it would combine everything from List1 into List2. I also tried it the other way around.

I'm using the maps to group Airings so the key for each map is whatever I am grouping by and each key returns one or more Airings.

Thanks for your continued help.

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #4  
Old 12-30-2009, 09:52 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Since you are not coding directly in java can you not do a dataunion or dataintersection before the grouping since in the end you are grouping the same anyways.

Pluckyhd
Reply With Quote
  #5  
Old 12-30-2009, 01:11 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by PLUCKYHD View Post
Since you are not coding directly in java can you not do a dataunion or dataintersection before the grouping since in the end you are grouping the same anyways.

Pluckyhd
I'm not grouping them the same. I am using GroupByMethod() on several different data sets (using different methods) and then combining the groups.

I decided just to combine the groups manually by spinning through all of the elements and using AddToGrouping(). It's not elegant but it works.

The bad news is that I have a lot to learn about java. The good news is that I've installed Netbeans and have started doing some experiments.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #6  
Old 12-30-2009, 01:45 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
I'm not grouping them the same. I am using GroupByMethod() on several different data sets (using different methods) and then combining the groups.

I decided just to combine the groups manually by spinning through all of the elements and using AddToGrouping(). It's not elegant but it works.

The bad news is that I have a lot to learn about java. The good news is that I've installed Netbeans and have started doing some experiments.
Good start Tom trust me you will find netbeans allot easier to code in than studio once you get it going.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Music folders! joematt SageTV Beta Test Software 0 03-12-2009 09:18 PM
Combining OTA and QAM possible? dinki Hardware Support 8 08-08-2008 04:23 PM
Combining shares in NAS Lite? matt91 The SageTV Community 3 01-04-2008 02:58 PM
Combining 2 sagetv mpg files together? steingra General Discussion 7 11-07-2005 07:03 PM
Combining MPG files? kelemvor General Discussion 7 11-05-2005 11:34 PM


All times are GMT -6. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.